Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properties order #571

Closed
mfulton26 opened this issue Mar 22, 2018 · 6 comments
Closed

Properties order #571

mfulton26 opened this issue Mar 22, 2018 · 6 comments

Comments

@mfulton26
Copy link

mfulton26 commented Mar 22, 2018

UI generation tools would benefit, I think, from having a way to specify the order of properties.

For simple cases, perhaps properties could be optionally defined as an array of objects where at a minimum each object has a name property:

"properties": [
  {
    "name": "foo",
    "type": "string"
  },
  {
    "name": "bar",
    "type": "boolean"
  }
]

Alternatively a new keyword could be introduced, propertiesOrder:

"properties": {
    "bar": { "type": "boolean" },
    "foo": { "type": "string" }
},
"propertiesOrder": ["foo", "bar"]

This keyword could also support patterns:

"properties": {
    "bar": { "type": "boolean" },
    "foo": { "type": "string" },
    "num": { "type": "number" }
},
"propertiesOrder": [".*", "foo", "bar"]
@Relequestual
Copy link
Member

Feel free to file that over at https://github.com/json-schema-org/json-schema-vocabularies/issues - Currently this repo is for core and validation. Neither specify any UI generation. There are a few efforts already looking at this outside of official JSON Schema channels, such as https://github.com/json-schema-form and https://github.com/mozilla-services/react-jsonschema-form

@mfulton26
Copy link
Author

Okay, thank you for redirecting me. As I saw readOnly and writeOnly I figured this would be an appropriate place. If I wanted to suggest a disable and/or hidden keyword would that go over there too? Thanks.

@Relequestual
Copy link
Member

@mfulton26 sorry if I seemed a little heavy handed. I hadn't even noticed readOnly and writeOnly...

I'd probably want to see some of those annotation keywords moved out of the validation spec... seems kinda weird they are there but have nothing to do with validation.

Any comments @handrews ? =]

@dlax
Copy link
Member

dlax commented Mar 23, 2018

@Relequestual See #363 and #378 for why these keywords got into validation spec.

@handrews
Copy link
Contributor

@Relequestual the question of where the basic meta-data annotation keywords should live comes up regularly. Once we decide on a vocabulary approach (#561) we'll have a better feel for what the impact of moving or splitting that vocabulary out would be.

Right now, we don't really have a definition of "vocabulary" (it roughly equates to "specification document", except when it doesn't), which makes it hard to figure out what to do with it.

That said, property ordering is less about annotating with data (like a description) or an interaction hint (like readOnly or contentMediaType) and more about how to display things, so it really does belong in the other repository with the UI vocab proposal.

@mfulton26
Copy link
Author

mfulton26 commented Apr 6, 2018

I've created json-schema-org/json-schema-vocabularies#7. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants