Skip to content

Adding a detailed json-schema #440

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

Merged
merged 1 commit into from
Aug 1, 2015
Merged

Conversation

eneuhauser
Copy link

I saw that you just removed the json-schema, but I believe this schema is a good representation of JSON API and concisely explains the format.

@tkellen
Copy link
Member

tkellen commented Apr 6, 2015

Thanks for this @eneuhauser! I'm going to hold off on merging until we have marked 1.0.

@amaltson
Copy link

amaltson commented Jun 4, 2015

With 1.0 released, will this be considered for merging? This would help when documenting APIs with RAML.

@tkellen
Copy link
Member

tkellen commented Jun 4, 2015

Yes! Can you squash this to a single commit please?

"type": "string",
"format": "uri"
},
"linkage": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be data

@slaskis
Copy link

slaskis commented Jun 9, 2015

I've been using this schema and updated my version of it now to pass with 1.0 (including your comments @ethanresnick).

Since you did most of the work feel free to update this PR with my gist: https://gist.github.com/slaskis/f4f32beeea0080320e00

@eneuhauser
Copy link
Author

@tkellen I've updated the schema to match the new 1.0 format and squashed into a single commit. I validated the schema complies with the example on the homepage using JSON Schema Lint.

@slaskis, thanks for your help. I used your changes to start out, but I did make some modifications based on the current format of the spec. Please let me know if you see any issues.

@slaskis
Copy link

slaskis commented Jun 11, 2015

@eneuhauser happy to help!

I was a bit lazy with the descriptions but I see you took care of that 👍

"$ref": "#/definitions/resource"
},
"uniqueItems": true
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this could be moved into something like "#/definitions/collection"? Not that it's re-used right now but just for clarity. If that's even the correct term, but "an array of resource objects" doesn't really fit in a nice and tidy string.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know about this one. You wouldn't create a new object to represent an array of resources, so I don't think it needs its own definition.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good points, ignore my ramblings please :)

[http://jsonapi.org/schema](http://jsonapi.org/schema). Please note that this
schema is not a perfect document. Just because a JSON document may validate
against this schema, that does not necessarily mean it is a valid JSON API
document. The schema is provided for a base level sanity check.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following this PR, and the preceding issue #271, I agree that a schema is helpful. If it doesn't validate all of the semantics of JSON API, then I would say it's like most schemas in that respect. It can yield some "false positives," where a given JSON input passes schema validation, but breaks some JSON API rules.

Still, I assume that whatever this schema does validate is in fact a requirement of the JSON API spec. So it should not yield any "false negatives." If a given input fails validation against this schema, then it's definitely not valid JSON API.

That's an important guarantee, and one worth stating in the FAQ, I think. Rather than saying it's "not a perfect document," say something like "Please note that this schema only enforces a subset of the JSON API specification."

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wording was taken from the previous JSON Schema. The previous schema was a lot more simplistic, so your suggestions are more appropriate for this version of the schema.

I reused the wording because I didn't want to get into the politics of how it should read, but I can take a crack at updating the copy match what this schema does and doesn't do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind doing that @eneuhauser and pinging back when ready? I'd love to get this merged but it would be nice for it to be a bit more clear.

@eneuhauser
Copy link
Author

@tkellen, I've updated the FAQ with the spirit of the schema definition. I also cleaned up some whitespace issues with the schema if you notice differences there. Please review and let me know if it is sufficient. Thanks!

@tkellen
Copy link
Member

tkellen commented Jul 31, 2015

thanks @eneuhauser!

cc @dgeb @ethanresnick @steveklabnik

@dgeb
Copy link
Member

dgeb commented Aug 1, 2015

I haven't reviewed the schema definition in detail, but it looks like a great start.

I suggest we merge and allow for refinement (if needed).

Thanks so much for your work here @eneuhauser!

tkellen pushed a commit that referenced this pull request Aug 1, 2015
Adding a detailed json-schema
@tkellen tkellen merged commit 3f64e4f into json-api:gh-pages Aug 1, 2015
@bf4
Copy link
Contributor

bf4 commented Oct 26, 2015

Just want to confirm, unless I'm not seeing it, that this schema was manually generated and is not as authoritative as the /format page? e.g. it includes info which isn't there.

@ethanresnick
Copy link
Member

Just want to confirm, unless I'm not seeing it, that this schema was manually generated and is not as authoritative as the /format page

Correct. The current schema is non-normative and has a few known issues (see #867)

@bf4
Copy link
Contributor

bf4 commented Nov 13, 2017

ref multiple schemas PR for discussion #1127

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

Successfully merging this pull request may close these issues.

8 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy