Go-swagger: types don't match: expect map key string or int get: bool

Created on 18 Apr 2016  路  4Comments  路  Source: go-swagger/go-swagger

Problem statement

swagger generate server -A TestAPI -f ./swagger.yml`

gives this error types don't match: expect map key string or int get: bool

Swagger specification

consumes:
- application/json
definitions:
  viewBox:
    type: object
    properties:
      x:
        type: integer
        format: int16
      # y -> types don't match: expect map key string or int get: bool
      y:
        type: integer
        format: int16
      width:
        type: integer
        format: int16
      height:
        type: integer
        format: int16
info:
  description: Test RESTful APIs
  title: Test Server
  version: 1.0.0
basePath: /api
paths:
  /test:
    get:
      operationId: findAll
      parameters:
        - name: since
          in: query
          type: integer
          format: int64
        - name: limit
          in: query
          type: integer
          format: int32
          default: 20
      responses:
        200:
          description: Array[Trigger]
          schema:
            type: array
            items:
              $ref: "#/definitions/viewBox"
produces:
- application/json
schemes:
- https
swagger: "2.0"

Steps to reproduce

Change the y property to any other word and the spec will validate.

Most helpful comment

Just use quotes as 'y', it should solve the problem.

All 4 comments

This is spec'ed by yaml, the only thing that you can do to not have it convert to boolean is use a different key value or to use json as format for the spec. see: http://yaml.org/type/bool.html

Just use quotes as 'y', it should solve the problem.

馃憤

Was this page helpful?
0 / 5 - 0 ratings