Skip to content

Update JSON Schema to be v1.0 compliant #1555

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

Closed
wants to merge 1 commit into from

Conversation

Relequestual
Copy link

@Relequestual Relequestual commented Mar 31, 2021

These changes fix a number of issues in the schema which make it invalid or incomplete in terms of validating JSON:API response payloads.

Resolves #1554

These changes fix a number of issues in the schema which make it invalid or incomplete in terms of validating JSON:API response payloads.
@Relequestual
Copy link
Author

@guillemcanal thanks for your work in #1487! =]
I've taken a slightly different approach here to solve the same problem.

I'd suggest closing #1487 in favour of this PR.

@guillemcanal
Copy link

@Relequestual LGTM. By the way, do you plan to create a test suite to validate every examples given in the spec against the JSONSchema ? It may be safer :)

@Relequestual
Copy link
Author

Relequestual commented Apr 14, 2021

@Relequestual LGTM. By the way, do you plan to create a test suite to validate every examples given in the spec against the JSONSchema ? It may be safer :)

If someone wants to find a way to extract them from the spec, I'm happy to do the validation test work. Otherwise, I don't have the bandwidth immediatly.

@Relequestual
Copy link
Author

I'll try to make some time this week to double check the schema and then remove the draft status.

@dgeb
Copy link
Member

dgeb commented Apr 15, 2021

I'll try to make some time this week to double check the schema and then remove the draft status.

@Relequestual Thank you, much appreciated!

@claudenirmf
Copy link

This is a much appreciated contribution. How would you proceed with testing? I personally prefer to split a schema as large as this one, but I have not found a good solution to bundle split schemas into a single file yet. Also, do you plan to submit your tests to the repository?

@Relequestual
Copy link
Author

Sorry it has taken me a little while to get back to you here.
I'm very much snowed under in terms of what I want to get done in JSON Schema land.

How would you proceed with testing? I personally prefer to split a schema as large as this one, but I have not found a good solution to bundle split schemas into a single file yet. Also, do you plan to submit your tests to the repository? - @claudenirmf n

My testing suggestion was related to examples in the specification. If they could be extracted, they could be tested against the schema. What language is up to you. I'd stick to what I know and a library that supports 2019-09 or above.

In terms of split files. This schema is actually pretty basic, but I still sometimes split even small schemas into multiple smaller ones.

@claudenirmf why would you need to bundle them into a single file?

@Relequestual
Copy link
Author

Realistically I'm not sure I'm going to have time to review this soon.

If someone wants to review and approve it, then please do, but I make no assurances here 😅.

@Relequestual Relequestual marked this pull request as ready for review May 17, 2021 14:23
@claudenirmf
Copy link

In terms of split files. This schema is actually pretty basic, but I still sometimes split even small schemas into multiple smaller ones.

Thanks for your response. You are correct, it is a basic schema. I admit that my memory of the actual schema tricked me (past me did not find JSON Schema very readable to begin with).

@claudenirmf why would you need to bundle them into a single file?

Some applications can only handle single file schemas, either because of libraries that cannot handle references, or because you want to deliver the schema as a single file (I'm thinking of describedby here).

{"required": ["relationships"]},
{"required": ["links"]},
{"required": ["id"]},
{"required": ["type"]}
Copy link

@bill-okara bill-okara Jun 16, 2021

Choose a reason for hiding this comment

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

would this then allow "id" and "type" as attributes member, would that violate one of the restrictions for fields?

a resource can not have an attribute and relationship with the same name, nor can it have an attribute or relationship named type or id.

"not": {
"anyOf": [
{"required": ["id"]},
{"required": ["type"]}

Choose a reason for hiding this comment

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

should this be moved up one level instead of removed to satisfy the restriction

a resource can not have an attribute and relationship with the same name, nor can it have an attribute or relationship named type or id.

@Relequestual
Copy link
Author

I hope to come back to this at some point soon! =D

Comment on lines +374 to +375
"type": "string",
"$comment": "The spec doesn't specify that this MUST be a string, so this could be changed to additionally allow numbers"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also allow null values?

@auvipy
Copy link

auvipy commented Dec 21, 2021

any progress on this? what aboy v1.1?

@Relequestual
Copy link
Author

Closing in favour of #1600
Sorry, I don't have enough time to dig into this enough to be helpful.
It's been a while since I read the JSON:API spec. It's very much not fresh.

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.

JSON Schema for JSON:API v1.0 is incomplete or broken
7 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