Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors for unknown format #48

Closed
robianmcd opened this issue Sep 4, 2019 · 4 comments
Closed

Errors for unknown format #48

robianmcd opened this issue Sep 4, 2019 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@robianmcd
Copy link

An error is thrown when there is a custom format on a property. e.g. if the api spec has something like:

properties:
  phoneNumber:
    type: string
    example: +15017122661
    format: phone-number

This will result in an error like

Error: unknown format "phone-number" is used in schema at path "#/properties/body/properties/phoneNumber"

The OpenAPI spec is pretty flexible on formats so I think this should be allowed. E.g. this page says (https://swagger.io/specification/):

Primitives have an optional modifier property: format. OAS uses several known formats to define in fine detail the data type being used. However, to support documentation needs, the format property is an open string-valued property, and can have any value. Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

@cdimascio
Copy link
Owner

Agreed. This should be looked at.

@cdimascio cdimascio added enhancement New feature or request help wanted Extra attention is needed labels Sep 6, 2019
cdimascio pushed a commit that referenced this issue Oct 8, 2019
@cdimascio
Copy link
Owner

cdimascio commented Oct 8, 2019

i've made progress on this issue. A fix should be available by the end of the week. the fix will also resolve #56

@cdimascio cdimascio self-assigned this Oct 8, 2019
cdimascio added a commit that referenced this issue Oct 8, 2019
Errors for unknown format #48 and #56
@cdimascio
Copy link
Owner

cdimascio commented Oct 8, 2019

@robianmcd @richdouglasevans @Silkjaer Unknown formats are supported in v2.4.0, see unknownFormats doc under Options. Please give it a spin. I welcome any feedback

@robianmcd
Copy link
Author

Great to hear. Thanks!

@cdimascio cdimascio removed the help wanted Extra attention is needed label Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants