integer enums
mr-tron opened this issue · comments
Denis Subbotin commented
Lates oapi-codegen from master.
openapi: 3.0.1
info:
title: test
description: API description in Markdown.
version: 0.1.0
servers: []
paths:
/test:
get:
summary: test
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/B'
components:
schemas:
B:
type: object
properties:
A:
type: integer
enum:
- 1
- 2
command:
oapi-codegen --generate types /tmp/swagger.yaml
output:
// Package Swagger provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
package Swagger
// Defines values for BA.
const (
BA BA = 1 <----------------------------------- PROBLEM
BA1 BA = 2
)
// B defines model for B.
type B struct {
A *BA `json:"A,omitempty"`
}
// BA defines model for B.A.
type BA int
Do you see problem? I think for itegers type we should add integer value to name. Like
const (
BA1 BA = 1
BA2 BA = 2
BA146 BA = 146
)
Vlastimil Hajek commented