-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Error building code generated with enum values as digits #341
Copy link
Copy link
Closed
Description
If there are numbers in enum values generated code is impossible to build.
yaml example:
openapi: 3.0.2
info:
title: ...
version: 0.0.0
paths:
/foo:
get:
responses:
200:
description: ...
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Bar'
components:
schemas:
Bar:
type: string
enum:
- 1
- Foo
- Bar
- Foo Bar
- Foo-Bar
- 1Foo
- Bar
- ' Foo'
- ' Foo '
- _Foo_
The issue is related due to enum values map generator.
To be percise the problem appears here:
sanitized := SchemaNameToTypeName(SanitizeGoIdentity(n))
it may be related to @vlastahajek fix #241
Result code for the above yaml will have:
const (
Bar = "1"
...
and
// Bar defines model for Bar.
type Bar string
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels