-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix enum type generators template #959
Conversation
pom.xml
Outdated
@@ -12,7 +12,7 @@ | |||
|
|||
<groupId>io.swagger.codegen.v3</groupId> | |||
<artifactId>swagger-codegen-generators</artifactId> | |||
<version>1.0.28-SNAPSHOT</version> | |||
<version>3.0.29-SNAPSHOT</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to make this change. It will create a mess on version releases
I reviewed and tested changes on this PR, there is a build error on generated code. The error is related to Adapter code swagger-codegen-generators/src/main/resources/handlebars/Java/modelEnum.mustache Lines 57 to 68 in 897d9b3
|
How can I replicate the bug on the adapter?
I didn't touch the adapter code
…On Tue, Sep 21, 2021, 1:52 AM HugoMario ***@***.***> wrote:
I reviewed and tested changes on this PR, there is a build error on
generated code. The error is related to Adapter code
https://github.com/swagger-api/swagger-codegen-generators/blob/897d9b3d01efe8e1f79a5bcb5e44181bf66d1694/src/main/resources/handlebars/Java/modelEnum.mustache#L57-L68
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#959 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN3GUHRJ6NCEJUNP6J36L3UDBBUTANCNFSM5EDYBQXA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
* master: added option gitRepoBaseURL for PHP generator
I didn't touch the adapter code. Could you please point out the problem? |
Hey @sbilello, The adapter code makes a call to the enum |
this is an eample i use to reproduce the build problem: openapi: 3.0.3
servers: []
info:
description: Nested Objct Sample.
version: "1.0.0"
title: Nested Object
termsOfService: 'http://swagger.io/terms/'
contact:
email: apiteam@swagger.io
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
tags:
- name: nestedObject
description: Everything about your Pets
externalDocs:
description: Find out more
url: 'http://swagger.io'
- name: store
description: Access to Petstore orders
- name: user
description: Operations about user
externalDocs:
description: Find out more about our store
url: 'http://swagger.io'
paths:
/nestedObject:
get:
operationId: checkNestedObject
parameters:
- name: nestedObject
in: query
description: nested object.
required: true
style: deepObject
schema:
$ref: '#/components/schemas/NestedObject'
responses:
200:
description: good
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
components:
schemas:
ObjectWithEnum:
type: object
description: The base meeting object.
properties:
topic:
type: string
description: The meeting's topic.
type:
type: integer
description: |-
The type of meeting:
* `1` — An instant meeting.
* `2` — A scheduled meeting.
* `3` — A recurring meeting with no fixed time.
* `8` — A recurring meeting with fixed time.
default: 2
#### THIS CAUSES PROBLEM IN THE SERIALIZATION BECAUSE THE ENUMS VALUES ARE NUMBERS AND NOT STRINGS
enum:
- 1
- 2
- 3
- 8
x-enum-descriptions:
- Instant meeting.
- Scheduled meeting.
- Recurring meeting with no fixed time.
- Recurring meeting with fixed time.
Parakeet:
type: object
properties:
color:
type: string
soundRepeater:
type: boolean
NestedObject:
type: object
properties:
name:
type: string
types:
type: array
items:
type: string
parakeet:
$ref: '#/components/schemas/Parakeet'
count:
type: integer
enable:
type: boolean
|
@HugoMario Thanks for your reply! I added the fix but I was not able to replicate the bug with the example provided in the above message. Please check this project that uses your example and generates the corresponding client: I don't see "Adapter" code for the Please provide steps to reproduce the problem or eventually open a PR on that test project if the fix provided does not solve the problem. Thank you again! |
Hey @sbilello I just generated code with your changes using the spec i shared here.
and i got the buid errors. I'll try again later with your changes and let you know. |
@HugoMario I used your spec in that example project. I don't have any build errors. Did you try to clone https://github.com/sbilello/swagger-gen-bug-enum-parameters/tree/java8EnumCompilingTest that contains your spec? |
@frantuma @HugoMario @gracekarina Could you please take a look? |
This is necessary to solve swagger-api/swagger-codegen#11166
Please take a look @HugoMario