ErikWittern / openapi-snippet

Generates code snippets for given Swagger / Open API documents
MIT License
115 stars 66 forks source link

Add swagger escape character https://swagger.io/docs/specification/u… #78

Open apilabeyes opened 2 years ago

apilabeyes commented 2 years ago

…sing-ref/

ErikWittern commented 2 years ago

@apilabeyes Thanks for the PR. Would you mind adding a test case for this behaviour also?

Consider also that escaping should only take place in the parts of a reference that uses these characters literally. Like in the official example, the reference to path path /blogs/{blog_id}/new~posts becomes $ref: '#/paths/~1blogs~1{blog_id}~1new~0posts' after escaping. So there are still slashes and tildes left in the final reference string. Does your implementation account for that?