Forum Discussion
HKosova
SmartBear Alumni (Retired)
Hi Raj, try wrappin the $ref into allOf:
TitleWithDefault
allOf:
- $ref: '#/components/schemas/Title'
default: Unknown
kashira
4 years agoNew Contributor
G'day,
I am not sure I followed as you suggested - it still did not work.
Regards,
- HKosova4 years agoSmartBear Alumni (Retired)
Can you please post your entire "components" section with all schemas?
- kashira4 years agoNew Contributor
G'day Helen,
Thanks so much for spending time to help me with this. I posting the complete yml.
openapi: 3.0.0info:title: Customers APIdescription: Customer resourceversion: 1.0.0contact:name: Rajemail: Rajendra.Kashi@gmail.compaths:/customers:get:description: to retireve all the customer detailsummary: This route retrieves all the customer detailresponses:200:description: retieves all the customer informationcontent:application/json:schema:$ref: '#/components/schemas/CustomersRetrieveResponse'/customers/{customer_id}:get:description: retrieve customersummary: This route retrieve customer by customer idparameters:- in: pathname: customer_idrequired: truedescription: customer idschema:type: stringresponses:200:description: retieves all the customer informationcontent:application/json:schema:$ref: '#/components/schemas/CustomerRetrieveResponse'post:description: create customersummary: This route retrieves all the customer detailrequestBody:required: falsecontent:application/json:schema:$ref: '#/components/schemas/CustomerCreateRequest'responses:200:description: Descriptioncontent:application/json:schema:type: stringcomponents:schemas:CustomersRetrieveResponse:type: arrayitems:$ref: '#/components/schemas/CustomerRetrieveItem'CustomerRetrieveResponse:$ref: '#/components/schemas/CustomerRetrieveItem'CustomerCreateRequest:$ref: '#/components/schemas/CustomerCreateItem'CustomerCreateItem:required:- first_name- last_nameallOf:- $ref: '#/components/schemas/CustomerTitleWithDefault'- $ref: '#/components/schemas/CustomerBasicData'CustomerRetrieveItem:allOf:- $ref: '#/components/schemas/CustomerId'- $ref: '#/components/schemas/CustomerTitle'- $ref: '#/components/schemas/CustomerBasicData'CustomerBasicData:type: objectproperties:first_name:type: stringlast_name:type: stringCustomerId:type: objectproperties:id:type: stringCustomerTitleWithDefault:allOf:- $ref: '#/components/schemas/CustomerTitle'default: Unknown#type: object#properties:# title:# type: string# enum:# - Mr# - Mrs# - M/S# - Dr# - Unknown# default: UnknownCustomerTitle:type: objectproperties:title:type: stringenum:- Mr- Mrs- M/S- Dr- UnknownThanking you,Raj
Related Content
- 5 years ago
- 5 years ago
- 4 years ago
- 4 years ago
Recent Discussions
- 2 days ago
- 3 days ago
- 20 days ago