Redocly / redocly-cli

⚒️ Redocly CLI makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more.
https://redocly.com/docs/cli/
MIT License
908 stars 138 forks source link

`problem-details-rfc7807` built-in rule #392

Closed adamaltman closed 2 years ago

adamaltman commented 2 years ago

Is your feature request related to a problem? Please describe.

This is a common format. It would be good to enforce this with a single line in the .redocly.yaml file.

Describe the solution you'd like

problem-details-rfc7807: error

Enforcing a specific shape of the response for 4xx errors, such as following the application/problem+json https://datatracker.ietf.org/doc/html/rfc7807 format.

Describe alternatives you've considered None

Additional context None

iosypov commented 2 years ago

@adamaltman i have on question. Should we only validate when response type application/problem+json or we should show error when in 4xx response type is not application/problem+json and then validate details by spec rfc7807?

RomanHotsiy commented 2 years ago

I would do both.

adamaltman commented 2 years ago

@RomanHotsiy do you mean by some configuration variable?

I think it would validate that all 4xx response types are content type application/problem+json.

RomanHotsiy commented 2 years ago

But should we also validate the response schema? Like check if it has type, title, etc.?