swagger generate server -A TestAPI -f ./swagger.yml`
gives this error types don't match: expect map key string or int get: bool
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"
Change the y property to any other word and the spec will validate.
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.
I added a test that shows the quoting works here: https://github.com/go-openapi/loads/blob/2c2eb3b11f02b34aa8428379e3e317d2d8f06d4d/fmts/yaml_test.go#L154
馃憤
Most helpful comment
Just use quotes as 'y', it should solve the problem.