#2376·go-swagger

Request for useful error message on "type:string"

Author: RubenGarciaCreated Aug 11, 2020Updated Jun 28, 2026
Labelsduplicatefuture/maybevalidate spec

Problem statement

if a swagger is missing a space in "type: string" and is written "type:string" swagger generate server produces "json: cannot unmarshal string into Go struct field SwaggerProps.definitions of type struct { spec.SchemaProps; spec.SwaggerSchemaProps }" Something like "Missing space in 'type:string' would be a better error message

Swagger specification

---
swagger: "2.0"
basePath: "/api/v0.1.2"
info:
  title: Test
  description: Test
  version: "0.1"
  contact:
    email: [email protected]
  license:
    name: Apache 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0.html'

definitions:
  Eudat:
    type: object
    properties:
      EUDATFIO:
        type:string 

paths:
  /test:
    get:
      responses:
        '200':
          description: test
          schema:
            $ref: "#/definitions/Eudat"

Steps to reproduce

swagger generate server

Environment

swagger version: v0.25.0 go version: 1.14.2 OS: Ubuntu 18.04.4 LTS