There is a similar question asked in Swagger: Reusing an enum definition as query parameter . My question is if I can use an enum (re-usable or non-reusable). Whenever I try to do this I get errors however using string does not give any error
/path/{protocol}:
patch:
summary:
operationId:
tags:
parameters:
- name: protocol
in: path
description: # some description
required: true
schema:
$ref: "#/components/schemas/ProtocolType"
ProtocolType:
type: string
default: abcd
enum:
- abcd
- aaa
- bbb
My question is if the above example is valid or what possible changes I should try. I am using OpenAPI 3.0.0 .
ERRORS:
Compilation errors in XX.client.cpp
XX.client.cpp: In static member function ‘static void
XX::SendSetProtocolReqRequest(std::string, const
XX::model::SetProtocolReq_Request*,
HTTPRequestEventContext::Ptr, uint64_t, HTTPClient*, FSM*, Statistics*,
std::string, bool)’:
XX_Management.client.cpp:1822:33: error: no matching function for call to
‘Json::ToValue(XX::model::XXEnumProtocolType*,
framework::json::Value*)’
Json::ToValue(¶m, &value);
^
I don't have much knowledge about XX.client.cpp . It is an auto-generated file which is built after yaml file is compiled.