Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7eef086
Added `/core/date-time`
sanderke Jul 24, 2025
8b98d6f
markdownlint
sanderke Jul 24, 2025
c982b06
Apply suggestions from code review
sanderke Aug 13, 2025
00ae440
Update sections/designRules.md
sanderke Aug 22, 2025
00d20c4
Verwerk feedback op basis van werksessie
TimvdLippe Oct 23, 2025
375c4d9
Vul tekst in bij TODOs
TimvdLippe Oct 23, 2025
b61be80
Update de bewoording
TimvdLippe Oct 23, 2025
89fc8bc
Zet het voorbeeld voor de regels
TimvdLippe Oct 23, 2025
daaefa1
Update bewoording
TimvdLippe Oct 23, 2025
aca3229
Update bewoording
TimvdLippe Oct 23, 2025
b983c0e
Update zin met time portion
TimvdLippe Oct 29, 2025
454e571
Add rule
sanderke Jul 24, 2025
239a7f8
Formatting
sanderke Jul 24, 2025
015633b
markdownlint
sanderke Jul 24, 2025
ee44da4
Apply suggestions from code review
sanderke Aug 13, 2025
3f34813
Added rule tag
sanderke Aug 13, 2025
3d4f08c
Update sections/designRules.md
sanderke Aug 22, 2025
7dbe3ad
problem schema members
sanderke Aug 22, 2025
5789d9e
test cases
sanderke Aug 22, 2025
6ad883d
conform feedback
sanderke Aug 29, 2025
4fd0ce8
Update linter/testcases/error-type-illegal-field/openapi.json
sanderke Aug 29, 2025
97a0511
updated expected outputs
sanderke Aug 29, 2025
04b7be5
fixed `nlgov:problem-schema-members`
sanderke Aug 29, 2025
326aca6
Correctie voorbeeld "instance"
sanderke Sep 4, 2025
df6964c
Verwerk feedback uit werksessie
TimvdLippe Oct 30, 2025
17737cf
Voeg noot toe over opslaan van originele timezone
TimvdLippe Oct 30, 2025
a186fe3
Update designRules.md
TimvdLippe Oct 30, 2025
8db1b25
Error handling (#275)
joostfarla Oct 30, 2025
d39ef92
Update designRules.md
TimvdLippe Oct 30, 2025
ba26c05
Voeg Spectral linter regels toe
TimvdLippe Oct 30, 2025
77ed6da
Voeg linter regel toe voor Bad Request vereiste
TimvdLippe Oct 30, 2025
8afad81
Voeg linter regels toe voor datum en tijd
TimvdLippe Nov 17, 2025
f4c6d21
Verwerken feedback van werksessie
TimvdLippe Nov 19, 2025
ff3f7ba
Voeg regel toe voor het valideren van request payload met schema
TimvdLippe Nov 24, 2025
378df7c
Enforceert 400 voor alle endpoints zonder parameters
TimvdLippe Dec 1, 2025
0af7852
Merge branch 'date-time' into kennisplatform-consultatie
TimvdLippe Dec 15, 2025
243d9c2
Merge branch 'rfc9457' into kennisplatform-consultatie
TimvdLippe Dec 15, 2025
1e82ad8
Update Respec configuration
TimvdLippe Dec 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions js/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ loadRespecWithConfiguration({
],
github: "https://github.com/Logius-standaarden/API-Design-Rules",
pubDomain: "api",
publishDate: "2025-08-27",
publishVersion: "2.1.0",
previousPublishDate: "2025-02-17",
previousPublishVersion: "2.0.2",
publishDate: "2026-01-12",
publishVersion: "2.2.0",
previousPublishDate: "2025-08-27",
previousPublishVersion: "2.1.0",
shortName: "adr",
specStatus: "WV",
specStatus: "CV",
specType: "ST",
pluralize: true,

Expand Down
124 changes: 123 additions & 1 deletion linter/spectral.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ rules:
functionOptions:
match: ^https://.*

#/core/error-handling/problem-details
nlgov:use-problem-schema:
severity: warn
severity: error
message: "The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457."
given: $..[responses][?(@property && @property.match(/(4|5)\d\d/))].content
then:
Expand All @@ -195,6 +196,77 @@ rules:
- required: ["application/problem+json"]
- required: ["application/problem+xml"]

nlgov:problem-schema-members:
severity: error
message: "{{error}}. These fields are required: status, title and detail."
given: $..[responses][?(@property && @property.match(/(4|5)\d\d/))].content[?(@property=="application/problem+json" || @property=="application/problem+xml")]..schema
then:
function: schema
functionOptions:
schema:
type: object
properties:
properties:
type: object
required:
- status
- title
- detail

#/core/error-handling/invalid-input
nlgov:problem-invalid-input:
severity: error
message: "GET endpoints that have parameters and all other endpoints must be able to return a 400 response"
given:
- $.paths..[?( @property.match(/get/) && @.parameters && @.parameters.length > 0 )]
- $.paths..[?( @property.match(/(put)|(post)|(delete)|(patch)/))]
then:
function: schema
functionOptions:
schema:
type: object
properties:
responses:
type: object
required:
- "400"

#/core/error-handling/bad-request
nlgov:problem-schema-members-bad-request:
severity: error
given: $..[responses][?(@property && @property.match(400))].content[?(@property=="application/problem+json" || @property=="application/problem+xml")]..schema.properties
then:
function: schema
functionOptions:
schema:
type: object
properties:
errors:
type: object
properties:
properties:
type: object
properties:
in: {}
detail: {}
location:
type: object
properties:
properties:
type: object
properties:
pointer: {}
name: {}
index: {}
additionalProperties: false
code: {}
required:
- in
- detail
additionalProperties: false
required:
- errors

nlgov:property-casing:
severity: warn
given:
Expand All @@ -206,6 +278,56 @@ rules:
field: "@key"
message: Properties must be lowerCamelCase.

#/core/date-time/timezone
nlgov:date-time-ensure-timezone:
severity: error
given: $..properties[*].format
message: "Use date-time format which includes a timezone"
then:
function: pattern
functionOptions:
notMatch: "/^date-time-local$/"

nlgov:time-without-timezone:
severity: error
given: $..properties[*].format
message: "Use time-local format without a timezone"
then:
function: pattern
functionOptions:
notMatch: "/^time$/"

#/core/date-time/date-omit-time-portion
nlgov:specify-format-for-date-and-time:
severity: error
given:
- $..properties[date,datum]
- $..properties[?(@property && @property.match(/((\w+D)|(_[dD]))((ate)|(atum))/))]
message: "Any date field must set 'format' to 'date'"
then:
function: schema
functionOptions:
schema:
anyOf:
- required: ["format"]
- properties:
allOf:
type: array
items:
required: ["format"]
required: ["allOf"]

nlgov:use-date-instead-of-datetime:
severity: error
given:
- $..properties[date,datum]..format
- $..properties[?(@property && @property.match(/((\w+D)|(_[dD]))((ate)|(atum))/))]..format
message: "Field represents a date and therefore must set 'format' to 'date'"
then:
function: pattern
functionOptions:
notMatch: "/^date-time$/"

nlgov:semver:
severity: error
message: "Version {{value}} is not in semver format."
Expand Down
51 changes: 26 additions & 25 deletions linter/testcases/cor-api/expected-output.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@

/testcases/cor-api/openapi.json
70:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./heartbeat.get.responses[429].content
80:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./heartbeat.get.responses[503].content
181:29 error nlgov:paths-kebab-case /laatsteWijziging is not kebab-case. paths./laatsteWijziging
211:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[400].content
221:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[404].content
231:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[405].content
241:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[406].content
251:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[429].content
261:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[500].content
271:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[503].content
506:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[400].content
516:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[404].content
526:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[405].content
536:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[406].content
546:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[429].content
556:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[500].content
566:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[503].content
684:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[400].content
694:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[404].content
704:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[405].content
714:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[406].content
724:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[429].content
734:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[500].content
744:35 warning nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[503].content
70:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./heartbeat.get.responses[429].content
80:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./heartbeat.get.responses[503].content
181:29 error nlgov:paths-kebab-case /laatsteWijziging is not kebab-case. paths./laatsteWijziging
211:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[400].content
221:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[404].content
231:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[405].content
241:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[406].content
251:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[429].content
261:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[500].content
271:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./laatsteWijziging.get.responses[503].content
506:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[400].content
516:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[404].content
526:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[405].content
536:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[406].content
546:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[429].content
556:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[500].content
566:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties.get.responses[503].content
684:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[400].content
694:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[404].content
704:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[405].content
714:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[406].content
724:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[429].content
734:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[500].content
744:35 error nlgov:use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457. paths./organisaties/{oin}.get.responses[503].content
978:27 error nlgov:use-date-instead-of-datetime Field represents a date and therefore must set 'format' to 'date' components.schemas.LocalDateTime.format

24 problems (1 error, 23 warnings, 0 infos, 0 hints)
25 problems (25 errors, 0 warnings, 0 infos, 0 hints)
14 changes: 14 additions & 0 deletions linter/testcases/date-time/expected-output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

/testcases/date-time/openapi.json
94:55 error nlgov:date-time-ensure-timezone Use date-time format which includes a timezone paths./resources-with-time-incorrect.get.responses[200].content.application/json.schema.properties.date-time-local.format
98:55 error nlgov:use-date-instead-of-datetime Field represents a date and therefore must set 'format' to 'date' paths./resources-with-time-incorrect.get.responses[200].content.application/json.schema.properties.date.format
102:55 error nlgov:use-date-instead-of-datetime Field represents a date and therefore must set 'format' to 'date' paths./resources-with-time-incorrect.get.responses[200].content.application/json.schema.properties.datum.format
106:55 error nlgov:use-date-instead-of-datetime Field represents a date and therefore must set 'format' to 'date' paths./resources-with-time-incorrect.get.responses[200].content.application/json.schema.properties.geboorteDatum.format
110:55 error nlgov:use-date-instead-of-datetime Field represents a date and therefore must set 'format' to 'date' paths./resources-with-time-incorrect.get.responses[200].content.application/json.schema.properties.birthDate.format
114:55 error nlgov:use-date-instead-of-datetime Field represents a date and therefore must set 'format' to 'date' paths./resources-with-time-incorrect.get.responses[200].content.application/json.schema.properties.expiration_date.format
118:55 error nlgov:use-date-instead-of-datetime Field represents a date and therefore must set 'format' to 'date' paths./resources-with-time-incorrect.get.responses[200].content.application/json.schema.properties.expiration_Date.format
122:55 error nlgov:time-without-timezone Use time-local format without a timezone paths./resources-with-time-incorrect.get.responses[200].content.application/json.schema.properties.timestamp.format
124:61 error nlgov:specify-format-for-date-and-time Any date field must set 'format' to 'date' paths./resources-with-time-incorrect.get.responses[200].content.application/json.schema.properties.missingFormatDate
218:27 error nlgov:use-date-instead-of-datetime Field represents a date and therefore must set 'format' to 'date' components.schemas.LocalDateTimeIncorrect.format

✖ 10 problems (10 errors, 0 warnings, 0 infos, 0 hints)
Loading
Loading