jsonsystems/json-schema

No settings for additional properties

lailatulrizqi22 opened this issue ยท 13 comments

The default value for additionalProperties is true, and this can be shown by using the verbose toggle. I guess what you're looking for is a way to add this to all objects?

Question: If the checkbox is true, since this is the default, would you expect it to be visible in the schema? Or would it only be visible if it was false (i.e. unchecked)?

@jackwootton, I'm looking for is a way to add this to all objects :)

@bestwebua How would a user turn this off if they didn't want it visible for all objects?

Like now. Maybe should add additional properties options toggle below the objects option?

this feature is a must have. It was there on the old interface. The current workaround adds a lot of redundant keys. Let me know if I can help here, would love to contribute since I use it so extensively.

@bestwebua the issue here is whether toggling-on additional properties should show true or nothing. This is why I have added the verbose toggle on the output panel, i.e.

# Always display this (there is no default).
additional_properties: false

# Only show this if the user has toggled-on verbose.
additional_properties: true

Despite it being a boolean, there are three states:

  • false
  • true (explicit)
  • true (implied)

IDK if this is a satisfactory solution or not. One of the drawbacks is that the verbose toggle will cause all implied keyword values to be explicitly rendered.

Just a thought: Can we add Display AdditionProperties in the INFER section with a toggle for true/false. If the user chooses this option in INFER section, the toggle will let them decide. Else, the verbose implementation stands.

@hanikhan not a bad idea, but this would have to be repeated for additionalItems and any other keyword that has a default value. We would end-up with two checkboxes for every boolean keyword (one denoting the value, and the other the visibility)

@jsonsystems I really like hanikhan's suggestion too.

How about something like this?

image

Make sense ๐Ÿ‘

@bestwebua @hanikhan @lailatulrizqi22 I've just released an update with this feature. Let me know if this works for you?

@jsonsystems It works like a charm! ๐Ÿฅ‡ Brilliant! ๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘