jsonsystems / json-schema

JSONSchema.Net Public Repository
Apache License 2.0
663 stars 64 forks source link

No settings for additional properties #70

Closed lailatulrizqi22 closed 4 years ago

lailatulrizqi22 commented 4 years ago
Screen Shot 2020-03-04 at 09 37 07
jackwootton commented 4 years ago

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)?

bestwebua commented 4 years ago

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

jackwootton commented 4 years ago

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

bestwebua commented 4 years ago

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

hanikhan commented 4 years ago

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.

jackwootton commented 4 years ago

@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:

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.

hanikhan commented 4 years ago

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.

jackwootton commented 4 years ago

@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)

bestwebua commented 4 years ago

@jsonsystems I really like hanikhan's suggestion too.

jackwootton commented 4 years ago

How about something like this?

image

bestwebua commented 4 years ago

Make sense :+1:

jackwootton commented 4 years ago

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

bestwebua commented 4 years ago

@jsonsystems It works like a charm! :1st_place_medal: Brilliant! :+1: :+1: :+1: