feat: add support for mediaTypes in OAS 3.2#2524
Conversation
🦋 Changeset detectedLatest commit: a1f0cbb The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1769775283 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1769775283
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1769775283
# or
npm install @redocly/respect-core@0.0.0-snapshot.1769775283 |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
tatomyr
left a comment
There was a problem hiding this comment.
Left a couple of minor comments.
tatomyr
left a comment
There was a problem hiding this comment.
One more round, and we're good to go, I believe.
| }); | ||
| expect(parsed.paths?.['/pets']?.get?.responses?.['200']?.content).toEqual({ | ||
| $ref: '#/components/mediaTypes/JsonPets', | ||
| }); |
There was a problem hiding this comment.
It's really challenging to read those expects. Could you use inline snapshots instead? Same in other places.
| openapi: 3.2.0 | ||
| components: | ||
| mediaTypes: | ||
| JsonPets: | ||
| 'application/json': | ||
| schema: | ||
| type: object | ||
| properties: | ||
| id: | ||
| type: integer | ||
| name: | ||
| type: string | ||
| examples: | ||
| example1: | ||
| value: | ||
| id: 1 | ||
| name: John |
There was a problem hiding this comment.
You don't have to wrap it into OpenAPI, it could be literally what you need:
application/json:
schema:
type: object
properties:
id:
type: integer
examples:
Test:
value:
id: 1| description: OK | ||
| content: | ||
| $ref: ./media-types.yaml#/components/mediaTypes/JsonPets | ||
| components: |
There was a problem hiding this comment.
What do you need components for? Please keep your tests minimal so it's easier to read them and understand the purpose. Avoid unnecessary fields (like summary and operationId since they are not needed for this particular test), and don't use strange naming like 'pets', just stick to foo, bar, test, user, etc., or some other general names.
This also applies to other test samples.
tatomyr
left a comment
There was a problem hiding this comment.
Much cleaner, thank you!
What/Why/How?
Added bundling support for OpenAPI 3.2
components/mediaTypesreferences used in request and response content.Reference
OpenAPI 3.2 support
openapi-docs changes
Testing
Screenshots (optional)
Check yourself
Security