-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Problem statement
A generation that was successful as per v0.19.0 doesn't work against .v0.30.3
Swagger specification
2.0
Steps to reproduce
tried to generate server for the file below
Environment GitPod / Mac
swagger version: v0.30.3
go version: go1.19.4 linux/amd64
OS: 5.15.0-47-generic #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
I just dusted off something I wrote that worked 2 years ago. See: https://github.com/stevef1uk/cassuservice
The swagger file my code generates is show below. I have put this in Swagger Editor & https://apitools.dev/swagger-parser/online/# and both are happy with it, however, swagger generate server -f swagger.txt gives the error: 'The swagger spec at "/workspace/go/src/github.com/stevef1uk/test4/swagger.txt" is invalid against swagger specification 2.0. see errors :
- some references could not be resolved in spec. First found: invalid character 's' looking for beginning of value
File contents:
swagger: '2.0'
info:
version: 1.0.0
title: Simple API
description: A generated file representing a Cassandra Table definition
schemes:
- http
host: localhost
basePath: /v1
paths:
/verysimple:
get:
summary: Retrieve some records from the Cassandra table
description: Returns rows from the Cassandra table
parameters:
- name: id
in: query
description: Primary Key field in Table
required: true
type: integer
format: int32
responses:
200:
description: A list of records
schema:
type: array
items:
required:
- id
- message
properties:
id:
type: integer
message:
type: string
400:
description: Record not found
default:
description: Sorry unexpected error
post:
tags:
- "Verysimple"
summary: Add a new record to the Cassandra table
description: Adds or updates a row in the Cassandra table
operationId: addVerysimple
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: The fields of the table that needs to be populates in JSON form
required: true
schema:
$ref: '#/definitions/Verysimple'
responses:
'201':
description: Record created
'405':
description: Invalid input
definitions:
Verysimple:
properties:
id:
type: integer
message:
type: string