Skip to content

Separate out JSON Schema into schema, schema-update, schema-create #1127

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 2 commits into from

Conversation

bf4
Copy link
Contributor

@bf4 bf4 commented Dec 12, 2016

Work by @eneuhauser from discussion in #867 (esp see #867 (comment) and #867 (comment) )just to maybe spur some work. (I'm still not confident with composing schema haven't built many myself.) cc @sebilasse

Eric Neuhauser added 2 commits September 23, 2015 13:20
@n2ygk
Copy link
Contributor

n2ygk commented Oct 18, 2017

@bf4 FYI I've recently done something similar in which I used the jsonapi schema to create a RAML 1.0 type library (JSON->YAML->RAML). I made a resource_post which allows the 'id' to be optional and then resource extends resource_post to make 'id' required.

I also found I had to do a similar thing for my "user" data types that extend resource, making mytype_patch which allows all attributes to be optional (for PATCHing) which is then extended by mytype_post (for POSTing) which identifies the required attributes and then mytype (for GETting) which extends the post to require the 'id'. Still not quite correct and not completely DRY.

Oh, and from another thread, the info response type goes with the DELETE 200 response:

200 OK

A server MUST return a 200 OK status code if a deletion request is successful and the server responds with only top-level meta data.

I wish I had seen this work before reinventing it! Oh well.

@bf4
Copy link
Contributor Author

bf4 commented Nov 13, 2017

Incidentally, I think the schema naming of success/failure/info is a little misleading.

  "oneOf": [
    {
      "$ref": "#/definitions/success"
    },
    {
      "$ref": "#/definitions/failure"
    },
    {
      "$ref": "#/definitions/info"
    }
  ],
  • a success schema has data and optionally meta, links, included, jsonapi
  • a failure schema has errors and optionally meta, jsonapi,(unclear if links is allowed)
  • an info schema has meta and optionally links, jsonapi

Why not just call them data, errors, meta?

@webjunkie
Copy link

I would need a schema for "create". Too bad there hasn't happened anything here in a while.

@Relequestual
Copy link

@dgeb I started to break them up, but my current requirements and timelines don't allow me to complete that right now.
Is this something you're interested in?
I also note, the schema only validates responses, and separate schemas would be required to validate requests.

@jelhan
Copy link
Contributor

jelhan commented Oct 31, 2022

I'm going to close this in favor of #1600. I hope that we can merge #1600 soon.

Thanks a lot @bf4 for starting the work!

@jelhan jelhan closed this Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 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