Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Semantic error at paths./MyType.get.responses.200.schema.$ref $ref values must be RFC3986-compliant percent-encoded URIs

I have an OData api and I enabled swagger for that. When I paste the json information of my OData api in "editor.swagger.io" then it gives me the error : (Semantic error at paths ./BankBranches.get.responses.200.schema.$ref $ref values must be RFC3986-compliant percent-encoded URIs)

I have below lines in responses :

responses: '200': description: OK schema: $ref: '#/definitions/ODataResponse[List[BankBranch]]'

I know that I can solve the problem by removing all the "[" , "]" but It is too hard and takes too much time in big projects. I do not know how to change in my OData api to do not have this problem??

like image 763
Mostafa Avatar asked Nov 07 '22 17:11

Mostafa


1 Answers

if your swaggerResponse looks something like

[SwaggerResponse(HttpStatusCode.OK, "OK Result", typeof(IEnumerable<int>))]

you could create a wrapper for the response

public class MyResponse: IEnumerable<ItemGroup>> {}

and update

[SwaggerResponse(HttpStatusCode.OK, "OK Result", typeof(MyResponse))]
like image 54
DrikusStander Avatar answered Nov 15 '22 10:11

DrikusStander