Variation tests not generated for 'application/merge-patch+json' route body
See original GitHub issueWhen trying to generate variation tests for a PATCH route, specifying ‘application/merge-patch+json’ in the OAS3 schema seems to block creation of the tests.
Generates tests:
"paths": {
"/": {
"patch": {
"description": "Updates existing item",
"operationId": "patch-item,
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/patchItem"
}
}
}
},
"responses": {
"204": {
"description": "Successfully updated the item."
},
"400": {
"$ref": "#/components/responses/400badrequest"
}
}
}
}
}
Does not generate tests:
"paths": {
"/": {
"patch": {
"description": "Updates existing item",
"operationId": "patch-item,
"requestBody": {
"content": {
"application/merge-patch+json": {
"schema": {
"$ref": "#/components/schemas/patchItem"
}
}
}
},
"responses": {
"204": {
"description": "Successfully updated the item."
},
"400": {
"$ref": "#/components/responses/400badrequest"
}
}
}
}
}
Note that the requestBody content is the only thing different.
The strange thing is that Portman knows about this type, because when it does generate tests, it properly sets the Content-Type header to ‘application/merge-patch+json’ in the generated tests.
Is this a bug, or am I doing something wrong? Thanks.
Issue Analytics
- State:
- Created a year ago
- Comments:13
Top Results From Across the Web
Use media type application/json-patch+json · Issue #13 - GitHub
According to the spec, JSON patch documents should really be using media type application/json-patch+json, instead of application/json.
Read more >Content-Type must be 'application/json-patch+json'
The error is clear. Is there a way to change the content type before perform the request for the JsonServiceClient? This is the...
Read more >A better way to implement HTTP PATCH operation in REST APIs
Possibly, a more scalable and effective way to write PATCH endpoints in your REST APIs using JSON Patch specification.
Read more >Update API Objects in Place Using kubectl patch - Kubernetes
Use kubectl patch to update Kubernetes API objects in place. Do a strategic merge patch or a JSON merge patch.
Read more >Using HttpClient to Send HTTP PATCH Requests in ASP.NET ...
In this article, we are going to learn how to use HttpClient to send HTTP PATCH requests to partially update resources on the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you for all your hard work, @thim81! You guys have created a really powerful tool!
hi @yelob ,
We are adding improvements to the anyOf, allOf, oneOf support, which we want to finish as part of the new release. Difficult to say about a timeline, I’m hoping to land everything next week.