Skip to content
This repository has been archived by the owner on Aug 8, 2018. It is now read-only.

Explicit error message + support example swagger key #210

Open
jagu-sayan opened this issue Jan 24, 2018 · 0 comments
Open

Explicit error message + support example swagger key #210

jagu-sayan opened this issue Jan 24, 2018 · 0 comments

Comments

@jagu-sayan
Copy link

jagu-sayan commented Jan 24, 2018

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant