Skip to content
Advertisement

OpenApi for php doesn’t render enum values correctly

I am building some documentation using OpenApi and Swagger, but I am unable to test it because of a js error.

I want to define a parameter that will accept specific values so I added enum in the schema attribute. I am defining the orderBy parameter in a GET request like this

*     @OAParameter(in="query", name="orderBy", required=false, allowEmptyValue=true, description="Sort type of results", examples={"asc", "desc"}, schema={"type": "string", "enum": {"asc", "desc"}, "default": "asc"})

When the documentation is generated I am getting the error below enter image description here

Developer tools

enter image description here

Advertisement

Answer

Removed examples attribute and it rendered properly.

*     @OAParameter(in="query", name="orderBy", required=false, allowEmptyValue=true, description="Sort type of results", examples={"asc", "desc"}, schema={"type": "string", "enum": {"asc", "desc"}, "default": "asc"})
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement