cancel
Showing results for 
Search instead for 
Did you mean: 

Why does SwaggerHub convert allOf to oneOf?

pwangsom
Regular Visitor

Why does SwaggerHub convert allOf to oneOf?

Here is my SwaggerHub link.

https://app.swaggerhub.com/apis/pwangsom/customer-api/2.0.5

 

I have created a NewBillingAddressInfo schema which comprises two inner schemas, NewBillingAddressHeader and NewBillingAddressBody. I used 'allOf' for composing both inner schemas together (line 2760).

NewBillingAddressHeader can be one of three different headers, so I used 'oneOf' to handle this (line 2693).

Also, NewBillingAddressBody can be one of two different bodies, I then used oneOf again (line 2636).

Therefore, I expect that NewBillingAddressInfo should compose of one NewBillingAddressHeader and one NewBillingAddressBody.

 

Here are my short schema definitions.

 

NewBillingAddressHeader:
oneOf:
- $ref: '#/components/schemas/NewBillingAddressIndyInfo'
- $ref: '#/components/schemas/NewBillingAddressOrgInfo'
- $ref: '#/components/schemas/NewBillingAddressIndyOrgInfo'

 

NewBillingAddressBody:
oneOf:
- $ref: '#/components/schemas/NewBillingAddressTh'
- $ref: '#/components/schemas/NewBillingAddressForiegn'

 

NewBillingAddressInfo:
allOf:
- $ref: '#/components/schemas/NewBillingAddressHeader'
- $ref: '#/components/schemas/NewBillingAddressBody'

 

However, SwaggerHub puts all of NewBillingAddressHeader and NewBillingAddressBody schemas together and uses the term 'oneOf' instead of 'allOf'. This does not guarantee that NewBillingAddressInfo should have one NewBillingAddressHeader and one NewBillingAddressBody.

 

Here is the example schema generated by SwaggerHub.

pwangsom_0-1620865339327.png

 

Please suggest to me, how to fix this issue.

 

Thank you

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors