2

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

*     @OA\Parameter(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

1 Answer 1

4

Removed examples attribute and it rendered properly.

*     @OA\Parameter(in="query", name="orderBy", required=false, allowEmptyValue=true, description="Sort type of results", examples={"asc", "desc"}, schema={"type": "string", "enum": {"asc", "desc"}, "default": "asc"})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.