Contributions
Re: I want to create a component one with default value other one without default value how to do
G'day Helen, Thanks so much for spending time to help me with this. I posting the complete yml. openapi:3.0.0 info: title:CustomersAPI description:Customerresource version:1.0.0 contact: name:Raj email:Rajendra.Kashi@gmail.com paths: /customers: get: description:toretireveallthecustomerdetail summary:Thisrouteretrievesallthecustomerdetail responses: 200: description:retievesallthecustomerinformation content: application/json: schema: $ref:'#/components/schemas/CustomersRetrieveResponse' /customers/{customer_id}: get: description:retrievecustomer summary:Thisrouteretrievecustomerbycustomerid parameters: -in:path name:customer_id required:true description:customerid schema: type:string responses: 200: description:retievesallthecustomerinformation content: application/json: schema: $ref:'#/components/schemas/CustomerRetrieveResponse' post: description:createcustomer summary:Thisrouteretrievesallthecustomerdetail requestBody: required:false content: application/json: schema: $ref:'#/components/schemas/CustomerCreateRequest' responses: 200: description:Description content: application/json: schema: type:string components: schemas: CustomersRetrieveResponse: type:array items: $ref:'#/components/schemas/CustomerRetrieveItem' CustomerRetrieveResponse: $ref:'#/components/schemas/CustomerRetrieveItem' CustomerCreateRequest: $ref:'#/components/schemas/CustomerCreateItem' CustomerCreateItem: required: -first_name -last_name allOf: -$ref:'#/components/schemas/CustomerTitleWithDefault' -$ref:'#/components/schemas/CustomerBasicData' CustomerRetrieveItem: allOf: -$ref:'#/components/schemas/CustomerId' -$ref:'#/components/schemas/CustomerTitle' -$ref:'#/components/schemas/CustomerBasicData' CustomerBasicData: type:object properties: first_name: type:string last_name: type:string CustomerId: type:object properties: id: type:string CustomerTitleWithDefault: allOf: -$ref:'#/components/schemas/CustomerTitle' default:Unknown #type:object #properties: #title: #type:string #enum: #-Mr #-Mrs #-M/S #-Dr #-Unknown #default:Unknown CustomerTitle: type:object properties: title: type:string enum: -Mr -Mrs -M/S -Dr -Unknown Thanking you, Raj1.6KViews0likes0CommentsI want to create a component one with default value other one without default value how to do
G'day All, Please can someone suggest me what is best way to write this component with reuse. Title: Type: string Enum: - Mr - Mrs - Unknown TitleWithDefault $ref: '#/components/schemas/Title' default: Unknown Is it possible? Please if someone knows the answer can you share it. Thanking you, RajSolved1.8KViews0likes6Comments