-
Notifications
You must be signed in to change notification settings - Fork 199
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
Add xml support to openapi3 #4214
base: main
Are you sure you want to change the base?
Conversation
skywing918
commented
Aug 20, 2024
•
edited
Loading
edited
- add test cases based on Examples
- add xml in OpenAPI3Schema type
- update schema-emitter logic for support xml object
// Resolve XML name | ||
const xmlName = resolveEncodedName(program, prop, "application/xml"); | ||
const jsonName = resolveEncodedName(program, prop, "application/json"); | ||
if (xmlName && xmlName !== prop.name && xmlName !== jsonName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if xmlName is undefined, prop.name = "bbb", jsonName == "aaa",
then we ignore json name.
is this expected?
@@ -737,7 +865,8 @@ export class OpenAPI3SchemaEmitter extends TypeEmitter< | |||
|
|||
#applyConstraints( | |||
type: Scalar | Model | ModelProperty | Union | Enum, | |||
original: OpenAPI3Schema | |||
original: OpenAPI3Schema, | |||
ref: OpenAPI3Schema = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to add ref? simply use 2nd parameter is enough?
@timotheeguerin as you mentioned, it need set the xml name in
Pet:
type: object
required:
- tags
properties:
tags:
type: array
items:
$ref: '#/components/schemas/Tag'
xml:
name: XmlTag
xml:
wrapped: true
xml:
name: XmlPet |
You need to wrap the properties:
tags:
type: array
items:
allOf:
- $ref: '#/components/schemas/Tag'
xml:
name: XmlTag
xml:
wrapped: true |