#53079 closed defect (bug) (invalid)
Rest API Json Schema is invalid
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | trivial | Version: | 5.7.1 |
Component: | REST API | Keywords: | reporter-feedback close |
Focuses: | docs, rest-api, coding-standards | Cc: |
Description
Hello i tried to validate JSON SCHEMA using online validators from https://json-schema.org/implementations.html#validators
Looks like the schema does not pass any validator. I would like to generate some client code in different languages but all of them says schema is invalid.
Overall i couldn't find a way to get the schema directly from wordpress documentation. After some googling i found out i have to call curl -X OPTIONS https://mydomain.com/wp-json/wp/v2/posts
and then there's a nested 'schema' property.
Also the docs at https://developer.wordpress.org/rest-api/reference/posts/ are kinda missleading because for the 'content' it says 'object' - so that can be actually anything?
I would really like to work with wordpress and the REST API it provides but overall i find it pretty difficult.
Change History (4)
#1
@
4 years ago
- Component changed from HTTP API to REST API
- Keywords needs-design needs-design-feedback removed
#3
@
2 years ago
- Keywords reporter-feedback close added; needs-patch dev-feedback needs-testing needs-docs removed
- Owner set to rachelbaker
- Priority changed from normal to low
- Severity changed from critical to trivial
- Status changed from new to assigned
The WordPress REST API schema follows the JSON-schema draft 6 specification. I tested a few endpoint schemas with some online validators and they passed.
In addition to the OPTIONS request, you can view a site's schema and endpoint documentation via the /wp-json
url path for any WordPress site and find the links to other registered endpoint schemas.
It is unclear the form of support you are seeking in this ticket. Can you share what was flagged as invalid and what error/validation output you receive?
#4
@
14 months ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from assigned to closed
It is unclear the form of support you are seeking in this ticket. Can you share what was flagged as invalid and what error/validation output you receive?
As there's been no follow-up since then, I'll close this ticket.
However, @bukowa if you get the opportunity to follow-up to Rachel's question and have more information, please reopen and share. Thank you.
I found out the OPTIONS is actually in the documenation at: https://developer.wordpress.org/rest-api/reference/#a-distributed-api
It says:
Is the format returned by that request following any standard beside the "schema" which is json-schema v4 ?