Skip to content

feat(problem+json): Add support for application/problem+json #1433

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions _testdata/examples/api.github.com.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
"200": {
"description": "Response",
"content": {
"application/json": {
"application/problem+json": {
"schema": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -96299,4 +96299,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion _testdata/examples/k8s.json
Original file line number Diff line number Diff line change
Expand Up @@ -1863,7 +1863,7 @@
],
"requestBody": {
"content": {
"application/json-patch+json": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.apis.meta.v1.Patch"
}
Expand Down
60 changes: 60 additions & 0 deletions _testdata/examples/problemjson.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
openapi: 3.0.1
info:
version: 1.0.0
title: API with Problems
paths:
/v1/test:
get:
operationId: getTest
responses:
"200":
x-summary: OK
description: Process me.
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: "Hello, World!"
"400":
x-summary: Bad Request
description: |
Something was wrong
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ProblemJsonErrorResponse'

components:
schemas:
ProblemJsonErrorResponse:
type: object
description: >-
An errors that occurred.
required:
- type
- title
- status
properties:
type:
type: string
description: >-
Identifies the type of the problem. If the problem type has no additional semantics beyond the HTTP status code, the URI `about:blank` is used.
example: "about:blank"
title:
type: string
description: >-
Roughly describes the problem. This is a static description, not a detailed one. If `type` is `about:blank`, the reason phrase of the status should be used as title.
example: Not Found
status:
type: integer
format: int32
description: HTTP status code.
example: 404
detail:
type: string
description: >-
Further details about the error.
example: The email address could not be found.
2 changes: 1 addition & 1 deletion examples/ex_github/oas_response_decoders_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex_github/oas_response_encoders_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

223 changes: 223 additions & 0 deletions examples/ex_k8s/oas_client_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions examples/ex_k8s/oas_faker_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading