APIDevTools / swagger-parser

Swagger 2.0 and OpenAPI 3.0 parser/validator
https://apitools.dev/swagger-parser
MIT License
1.11k stars 155 forks source link

Isn't Escaping special character like apostrophe and throwing error #27

Closed ranacseruet closed 8 years ago

ranacseruet commented 9 years ago

I am using such definition:


---
  swagger: "2.0"
  info: 
    version: "v0.1"
    title: "Test"
    description: ""
  paths: 
    /test: 
      parameters: []
      get: 
        responses: 
          200: 
            description: ""
            schema: 
              type: "string"
            examples: 
              application/json: "the devil’s place"
        parameters: []
        consumes: 
          - "application/json"
        produces: 
          - "application/json"
        operationId: "test"
        summary: ""
        description: ""
  definitions: {}
  basePath: "/mocks/a86239e0-d3af-48c6-9fd5-f8edc7c35d69"
  host: "http://mocksvc.mulesoft.com"
  schemes: 
    - "HTTP"
    - "HTTPS"
  produces: 
    - "application/json"
  consumes: 
    - "application/json"

This is causing error because of the line "the devil’s place" which include a special character of apostrophe. Is it possible to support escaping it(and such other characters) internally instead of throwing error?

the above definition is validated as valid yaml here: http://www.yamllint.com/

ranacseruet commented 8 years ago

it was a diff issue on my app side. closing it.