Generating code for the below document fails on the enum:
% go run oapi-codegen.go -generate types test.yaml
...
<some output>
...
: test.go:46:4: 'P' exponent requires hexadecimal mantissa (and 5 more errors)
exit status 1
It seems the reason is that the typeNamePrefix function in utils.go does not handle > or <, followed by a number. Also, the error message is different if you replace pepper below with anything not starting with p.
openapi: 3.0.0
info:
description: Find error in generation
version: 1.0.0
title: Error
paths:
/api:
get:
summary: Do stuff
responses:
"200":
$ref: '#/components/responses/SomeResponse'
components:
responses:
SomeResponse:
description: some response
content:
application/json:
schema:
$ref: '#/components/schemas/SomeSchema'
schemas:
SomeSchema:
type: object
properties:
some_enum:
type: string
enum:
- '>23 pepper'
Generating code for the below document fails on the enum:
It seems the reason is that the
typeNamePrefixfunction in utils.go does not handle>or<, followed by a number. Also, the error message is different if you replacepepperbelow with anything not starting withp.