aws-apigateway-importer icon indicating copy to clipboard operation
aws-apigateway-importer copied to clipboard

Explicit error message + support `example` swagger key

Open jagu-sayan opened this issue 7 years ago • 0 comments

I get hard to understand errors message when I put example key in the properties of an object schema in the import swagger tool of ApiGateway web client : image

This file is valid for swagger 2.0 editor.

swagger: '2.0'

info:
  version: "1.0.0"
  title: "ContactAPI"

host: "eample.io"
basePath: /
schemes:
  - https

paths:
  /contact:
    post:
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: body
          name: Message
          required: true
          schema:
            $ref: '#/definitions/Message'
      responses:
        200:
          description: "Email is sent"

definitions:
  Message:
    type: object
    required:
      - email
      - subject
      - message
    properties:
      email:
        type: string
        description: "Email 'From to'"
        format: email
      subject:
        type: string
        description: "Email subject"
        minLength: 10
        maxLength: 200
      message:
        type: string
        description: "Email message"
        minLength: 20
        maxLength: 500
    title: Message
swagger: '2.0'

info:
  version: "1.0.0"
  title: "ContactAPI"

host: "eample.io"
basePath: /
schemes:
  - https

paths:
  /contact:
    post:
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: body
          name: Message
          required: true
          schema:
            $ref: '#/definitions/Message'
      responses:
        200:
          description: "Email is sent"

definitions:
  Message:
    type: object
    required:
      - email
      - subject
      - message
    properties:
      email:
        type: string
        description: "Email 'From to'"
        format: email
      subject:
        type: string
        description: "Email subject"
        minLength: 10
        maxLength: 200
      message:
        type: string
        description: "Email message"
        minLength: 20
        maxLength: 500
        example: "My best message"
    title: Message
  • Diff
--- bug/work.yml	2018-01-24 19:16:26.831984710 +0100
+++ bug/bug.yml	2018-01-24 19:16:53.228787830 +0100
@@ -48,4 +48,5 @@
         description: "Email message"
         minLength: 20
         maxLength: 500
+        example: "My best message"
     title: Message

jagu-sayan avatar Jan 24 '18 18:01 jagu-sayan