Skip to content

Add JSON:API v1.1 support as an additive overlay#1

Open
arjenblokzijl wants to merge 2 commits into
mainfrom
feature/jsonapi-1.1-overlay
Open

Add JSON:API v1.1 support as an additive overlay#1
arjenblokzijl wants to merge 2 commits into
mainfrom
feature/jsonapi-1.1-overlay

Conversation

@arjenblokzijl

Copy link
Copy Markdown
Collaborator

Adds JSON:API v1.1 support without changing v1.0 behaviour.

jsonapi-1.1.yml extends the untouched .spectral.yml and only redefines the rules that changed in v1.1:

  • ext/profile media type parameters (content negotiation)
  • expanded links object members (rel, describedby, title, type, hreflang)
  • jsonapi object ext/profile/meta members
  • the lid local identifier on resource objects and resource identifier objects

Everything else is inherited unchanged, so existing v1.0 consumers are unaffected (non-breaking, bumped to 1.1.0).

Notes

  • Spectral does not inherit aliases through extends, so the alias block is duplicated into the overlay (rules are not). Flagged with a sync comment in the file.
  • Adds examples/valid-1.1/ exercising the new features and a test:1.1 script; npm test now lints both rulesets and passes (0 errors).

Before upstreaming (draft jmlue42#79)

  • Validate jsonapi-1.1.yml against our real API definitions, not just the fixture

Introduces jsonapi-1.1.yml, which extends the untouched v1.0 ruleset
(.spectral.yml) and only redefines the rules that changed in JSON:API
v1.1: the ext/profile media type parameters, expanded links object
members (rel, describedby, title, type, hreflang), the jsonapi object
ext/profile/meta members, and the lid local identifier on resource
objects and resource identifier objects.

The v1.0 ruleset is unchanged, so existing consumers are unaffected.
Spectral does not inherit aliases through extends, so the alias block
is duplicated into the overlay (rules are not).

Adds an examples/valid-1.1 fixture exercising the new features and a
test:1.1 script; npm test now lints both rulesets. Bumps to 1.1.0.
Note both v1.0 (.spectral.yml) and v1.1 (jsonapi-1.1.yml) rulesets,
how to select one per API version, and that the v1.1 file is an
additive overlay on top of v1.0.
@arjenblokzijl arjenblokzijl requested a review from joelcox June 26, 2026 13:09

@joelcox joelcox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ik kan zo'n spec nogal slecht reviewen, maar zie wederom veel kebab case, ook in URLs. Ook zou ik liever zien dat het een conceet voorbeeld gaat i.p.v. abstracte resources.

- 'qa'
default: 'dev'
paths:
/myResources:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/my-resources

- 'qa'
default: 'dev'
paths:
/myResources:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Allicht sowieso goed om dit minder abstract te maken. Posts en comments bijv.

- $ref: '#/components/parameters/sort'
responses:
'200':
$ref: '#/components/responses/MyResource_Collection'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Een schrijfwijze

'default':
$ref: '#/components/responses/DefaultError'
components:
securitySchemes:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Volgens mij niet relevant/niet gespacced in JSON:API, dus kan weg?

Copy link
Copy Markdown
Collaborator Author

op zich eens, maar onderstaande feedback is 1 op 1 overgenomen uit de originele voorbeelden. wilde eigenlijk zo frictieloos die 1.1 in main krijgen. ironisch 😏 kan het wel aanpassen, maar dan ook in de 1.0 versie lijkt me. waddayasay?

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.

2 participants