stoicflame / enunciate-openapi

OpenAPI3 module for Enunciate
Apache License 2.0
10 stars 10 forks source link

Enum schema with "YES" / "NO" literals may give true / false after second round of yaml parsing as not escaped. #18

Closed soberich closed 5 years ago

soberich commented 5 years ago

Parent issue https://github.com/smallrye/smallrye-open-api/issues/168 Yaml reserved keywords should be put in quotes The module now generates

components:
  schemas:
    "Insurance":
      title: "InsuranceStatus"
      type:  string
      enum:
        - YES
        - NO
        - NEVER

Which have high chance of giving being understood by yaml format as the following (or if, say, read into memory again). https://yaml.org/type/bool.html

components:
  schemas:
    Insurance:
      title: InsuranceStatus
      enum:
        - true
        - false
        - NEVER
      type:  string

THOUGH in examples are not affected and preserve "YES" / "NO" values for schemas' properties.

Format specific reserved words should be quoted/escaped.

jskov-jyskebank-dk commented 5 years ago

Fixed. Will also fix same problem for property names and required fields.

soberich commented 5 years ago

I found out this seems to could've been resolved simply by %YAML 1.2 directive at the beginning of the file. Nevermind, swagger-ui would've complain.