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

Explicit error message + support example swagger key #210

@jagu-sayan

Description

@jagu-sayan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions