8000 swagger validate: the need for better error messages · Issue #859 · go-swagger/go-swagger · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
swagger validate: the need for better error messages #859
Closed
@nathany

Description

@nathany

Problem statement

swagger validate produces some pretty unhelpful error messages, such as object has no key "" for the following incomplete swagger spec.

Contrast with an online Swagger validator like http://bigstickcarpet.com/swagger-parser/www/index.html (based on https://github.com/BigstickCarpet/swagger-parser) which specifically calls out:

Error resolving $ref pointer "#/responses/". 
Token "responses" does not exist.

Much more helpful.

Swagger specification

{
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "schemes": [
    "http"
  ],
  "swagger": "2.0",
  "info": {
    "description": "description",
    "title": "title",
    "version": "1.0"
  },
  "host": "localhost",
  "basePath": "/",
  "paths": {
    "/v1/authenticate": {
      "get": {
        "summary": "Authenticate with a token (JWT).",
        "operationId": "authHandler",
        "responses": {
          "200": {
            "$ref": "#/responses/"
          }
        }
      }
    }
  },
  "definitions": {}
}

Steps to reproduce

❯ swagger validate swagger.json
The swagger spec at "swagger.json" is invalid against swagger specification 2.0. see errors :
- object has no key ""

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0