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

Validating Swagger failed: invalid components: Unsupported 'format' value 'uuid' #282

Closed
AgentGoldPaw opened this issue Jan 2, 2021 · 1 comment

Comments

@AgentGoldPaw
Copy link

AgentGoldPaw commented Jan 2, 2021

I am trying to use openapi 3.0.0 + go 1.15.6

openapi: 3.0.0
info:
  version: "1.0.0"
  title: some api
tags:
  - name: customers
paths:
  /customers:
    post:
      tags:
        - customers
      summary: create a customer
      requestBody:
        description: Customer to add
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Customer"
      responses:
        201:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NewRecord"
  schemas:
    Customer:
      type: object
      properties:
        uuid:
          type: string
          nullable: false
          format: uuid
          readOnly: true
        username:
          type: string
          maxLength: 255
          nullable: false
          minLength: 1
          example: th3g3ntl3men
        phone:
          type: string
          maxLength: 255
          minLength: 1
          nullable: true
        email:
          type: string
          maxLength: 255
          minLength: 1
          nullable: true
        dob:
          type: string
          format: date
        pic:
          type: string
          maxLength: 255
          minLength: 1
        created_ts:
          type: string
          format: date-time
          readOnly: true
        updated_ts:
          type: string
          format: date-time
          readOnly: true

I do also use format:uuid in shared parameters.

@fenollp
Copy link
Collaborator

fenollp commented Jan 3, 2021

format: uuid is not defined by the OAS v3. We do provide an easy way to opt-in though:

DefineStringFormat("uuid", FormatOfStringForUUIDOfRFC4122)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants