You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
openapi: 3.0.3info:
title: Example appdescription: This is my test applicaitonversion: 1.0.0contact:
name: John Doeemail: [email protected]servers:
- url: https://dev.app.com/appApplicationNamedescription: DEVpaths:
/documentsWithCombineOneOf:
post:
description: ''summary: Add a document - KOrequestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/ModelPostDocumentOneOfCombineModelFile'operationId: testKosecurity:
- Basic: []tags: []responses:
'200':
$ref: '#/components/responses/Default'/documentsWithCombineWithoutOneOf:
post:
description: ''summary: Add a document - OKrequestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/ModelPostDocumentInvoiceCombineModelFile'operationId: test2security:
- Basic: []tags: []responses:
'200':
$ref: '#/components/responses/Default'/documentsWithCombineOneOfInBody:
post:
description: ''summary: Add a document - OKrequestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ModelPostDocumentOneOfCombineModelFile'operationId: test3security:
- Basic: []tags: []responses:
'200':
$ref: '#/components/responses/Default'components:
schemas:
AbstractModelPostDocument:
type: objectproperties:
title:
type: stringdefault: ''maxLength: 64example: MyDocument.pdf'category:
type: stringpattern: ''type:
type: stringdescription: Type depends on categoryissuingApplicationId:
type: stringenum:
- App1
- App2
- App3
- App4documentDate:
type: stringdescription: >- Creation date of the document. Example : For ID card, it is the issuing date of the card.format: datesharedWith:
type: arrayitems:
type: stringenum:
- CustomerPortal
- PartnerPortaluniqueItems: trueminItems: 0maxItems: 2required:
- title
- category
- type
- documentDate
- fileModelPostDocumentPolicy:
allOf:
- $ref: '#/components/schemas/AbstractModelPostDocument'
- type: objectproperties:
policyNumber:
type: stringdescription: Policy Numberexample: '132456'minLength: 1maxLength: 36pattern: ''description: Metadata for policy documentsrequired:
- policyNumberModelPostDocumentCustomer:
allOf:
- $ref: '#/components/schemas/AbstractModelPostDocument'
- type: objectproperties:
customerNumber:
type: numberdescription: Customer NumberexclusiveMinimum: trueminimum: 0exclusiveMaximum: truemaximum: 99999999999999organisationName:
type: stringenum:
- Organisation1
- Organisation2
- Organisation3description: Organisation Namerequired:
- organisationName
- customerNumberdescription: Metadata for Customer DocumentsModelPostDocumentInvoice:
allOf:
- $ref: '#/components/schemas/AbstractModelPostDocument'
- type: objectproperties:
invoiceNumber:
type: stringdescription: Invoice Numberexample: '132456'minLength: 1maxLength: 36pattern: ''amount:
type: numberexample: 1234.56description: Invoice Amountdescription: Metadata for invoice documentsrequired:
- amount
- invoiceNumberModelPostDocumentOneOf:
oneOf:
- $ref: '#/components/schemas/ModelPostDocumentPolicy'
- $ref: '#/components/schemas/ModelPostDocumentCustomer'
- $ref: '#/components/schemas/ModelPostDocumentInvoice'ModelFile:
type: objectproperties:
content:
type: stringformat: binaryrequired:
- contentModelPostDocumentOneOfCombineModelFile:
allOf:
- $ref: '#/components/schemas/ModelFile'
- type: objectproperties:
metadata:
$ref: '#/components/schemas/ModelPostDocumentOneOf'required:
- metadataModelPostDocumentInvoiceCombineModelFile:
allOf:
- $ref: '#/components/schemas/ModelFile'
- type: objectproperties:
metadata:
$ref: '#/components/schemas/ModelPostDocumentInvoice'description: metadatarequired:
- metadatasecuritySchemes:
Basic:
type: httpscheme: basicresponses:
Default:
description: Not neededheaders: {}content:
application/json:
schema:
type: stringdescription: not neededtags: []
Describe the bug you're encountering
When using oneOf for a property of a multipart/form-data, the json example is replaced by an empty string instead of an example while, according to the 2 other tests below, I expected it to be the example for the first element of the 'OneOf' relation.
Screenshot of the empty field :
Other tests in the attached YAML:
When not using oneOf for the multipart/form-data, the example is displayed. Example: in '/documentsWithCombineWithoutOneOf' the example for 'ModelPostDocumentInvoice' is displayed
When using oneOf for a POST with request body instead of mutipart/format-data, addtionaly to the schema, the first example of the 'OneOf' relation is displayed. Example: "/documentsWithCombineOneOfInBody, the ModelPostDocumentPolicy which is the first item of the oneOf relation of ModelPostDocumentOneOfCombineModelFile is displayed :
See that the example is replaced by an empty field
Expected behavior
Display the example for the first element of the 'OneOf' relation, like in the screenshot of '/documentsWithCombineWithoutOneOf'
Related issues
Other related issues but not duplicates: #5169: Display static documentation information for multipart properties in OpenAPI 3.0 files #7462 : When using oneOf with multipart/form-data the ability to upload a file is incorrectly replaced with a string
The text was updated successfully, but these errors were encountered:
Q&A
4.12.15.11.0Content & configuration
Example Swagger/OpenAPI definition:
Describe the bug you're encountering
When using oneOf for a property of a multipart/form-data, the json example is replaced by an empty string instead of an example while, according to the 2 other tests below, I expected it to be the example for the first element of the 'OneOf' relation.
Screenshot of the empty field :

Other tests in the attached YAML:
When not using oneOf for the multipart/form-data, the example is displayed.

Example: in '/documentsWithCombineWithoutOneOf' the example for 'ModelPostDocumentInvoice' is displayed
When using oneOf for a POST with request body instead of mutipart/format-data, addtionaly to the schema, the first example of the 'OneOf' relation is displayed.

Example: "/documentsWithCombineOneOfInBody, the ModelPostDocumentPolicy which is the first item of the oneOf relation of ModelPostDocumentOneOfCombineModelFile is displayed :
To reproduce...
Steps to reproduce the behavior:
Expected behavior
Display the example for the first element of the 'OneOf' relation, like in the screenshot of '/documentsWithCombineWithoutOneOf'
Related issues
Other related issues but not duplicates:
#5169: Display static documentation information for multipart properties in OpenAPI 3.0 files
#7462 : When using oneOf with multipart/form-data the ability to upload a file is incorrectly replaced with a string
The text was updated successfully, but these errors were encountered: