-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Problem statement
When using abbreviations (in my case PDF) and x-go-name, non-compiled code is generated.
Example: a parameter named pdf_extraction_mode (translated to a literal PdfExtractionMode) and its x-go-name PDFExtractionMode.
The code in the *Params structure is generated correctly (the name is the same as in x-go-name), however, in the generated SetDefaults code, the PdfExtractionMode literal is substituted, which breaks the compilation.
$ go build ./client/
client/operations/extract_pdf_parameters.go:94:3: unknown field 'PdfExtractionMode' in struct literal of type ExtractPdfParams
Swagger specification
swagger: "2.0"
info:
title: Sample API
description: API description in Markdown.
version: 1.0.0
host: api.example.com
basePath: /v1
schemes:
- https
paths:
/pdf:
get:
operationId: ExtractPdf
parameters:
- name: pdf_extraction_mode
type: string
enum:
- fast
- full
x-go-name: PDFExtractionMode
default: fast
description: Lorem ipsum
in: formData
responses:
200:
description: OK
Steps to reproduce
- swagger generate client -q -A buggygen --spec example.yaml
- trying to build this code (go build ./client)
Environment
swagger version: 0.30.3
go version: 1.19
OS: MacOS Catalina
Metadata
Metadata
Assignees
Labels
No labels