-
Notifications
You must be signed in to change notification settings - Fork 6k
[Typescript][Angular] bug: Enum generates empty name. #6822
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
Comments
@bedag-moo could you have a look at this? |
That is not my code; emitting this const was added by @kenisteward in f7471ad |
I'll take a look at this. Could you give me the complete example of your yaml or is this it? |
Also could you give me the full model generation so I can make sure I know what is wrong |
@HermenOtter I have a feeling it is because I used enum name somewhere I should have used class name but when I get your fully generated model example and a yaml to go off I can check for sure |
@HermenOtter Please check #6833 changes on my forked repo to see if it fixes your issue |
Thank you all for the fast responses. @kenisteward I tried your pull request with mvn clean package, but it didn't seem to work when I generated code from the new build. While building it gave a ton of warnings, but not sure if that is relevant. edit: responses:
200:
description: "Status 200"
schema:
type: "object"
properties:
items:
type: "array"
items:
type: "object"
allOf:
- type: "object"
properties:
code_bik:
type: "string"
bik:
type: "string"
indicatie_actief:
$ref: "#/definitions/indicatie_actief" indicatieActief.ts export type = 'J' | 'N';
export const = {
J: 'J' as ,
N: 'N' as
}
`` |
Just give me the bare bone properly configures yaml file while making sure
you replace all the names. I'm using enums as well and not having this
issue so I need an example to debug .
…On Mon, Oct 30, 2017, 4:44 AM Hermen Otter ***@***.***> wrote:
Thank you all for the fast responses. @kenisteward
<https://github.com/kenisteward> I tried your pull request with mvn clean
package, but it didn't seem to work when I generated code from the new
build(it had a ton of warnings btw, not sure if that is relevant).
I am not sure how much of the yaml file and the models I can post, I am
checking that currently and will report back.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6822 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMPLtY-RqRREQo335BPpDuw6LfJ0D_Eoks5sxYx6gaJpZM4QHk5q>
.
|
Also I just wanna make sure. It is generating the type part but not the
const part.
Also could you try it outside of the all of with my branch ?
On Mon, Oct 30, 2017, 8:27 AM Kenneth Steward <[email protected]>
wrote:
… Just give me the bare bone properly configures yaml file while making sure
you replace all the names. I'm using enums as well and not having this
issue so I need an example to debug .
On Mon, Oct 30, 2017, 4:44 AM Hermen Otter ***@***.***>
wrote:
> Thank you all for the fast responses. @kenisteward
> <https://github.com/kenisteward> I tried your pull request with mvn
> clean package, but it didn't seem to work when I generated code from the
> new build(it had a ton of warnings btw, not sure if that is relevant).
>
> I am not sure how much of the yaml file and the models I can post, I am
> checking that currently and will report back.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#6822 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AMPLtY-RqRREQo335BPpDuw6LfJ0D_Eoks5sxYx6gaJpZM4QHk5q>
> .
>
|
These are the definitions: definitions:
indicatie_actief:
type: "string"
description: "Indication whether the object is active or not"
enum:
- "J"
- "N"
indicatie_uniek:
type: "string"
description: "Indication whether the object is unique or not"
enum:
- "J"
- "N" @kenisteward I have been researching the issue and it seems you can't declare an enum in the root of a definition or something with the allOf like you said. I will try a code generation without using allOf and then report back to you. Do you have any idea on how to rewrite it having the same result, but without using an allOf? |
Soorten_relatie:
type: "object"
required:
- "code_soort_relatie"
- "soort_relatie"
- "indicatie_uniek"
- "indicatie_actief"
properties:
code_soort_relatie:
type: "string"
maxLength: 3
soort_relatie:
type: "string"
maxLength: 40
indicatie_uniek:
$ref: "#/definitions/indicatie_uniek"
indicatie_actief:
$ref: "#/definitions/indicatie_actief" Here is it used without an allOf. import { IndicatieActief } from './indicatieActief';
import { IndicatieUniek } from './indicatieUniek';
export interface SoortenRelatie {
codeSoortRelatie: string;
soortRelatie: string;
indicatieUniek: IndicatieUniek;
indicatieActief: IndicatieActief;
} It references IndicatieActief properly, but it does not generate the IndicatieActief nor IndicatieUniek. |
@HermenOtter Good news! I think I may have found the issue. The mustache template variable for class name should have been {{classname}} but i made it {{className}} in mine. my apologies. check my pr for the latest. Sorry for the issue! I made sure to use your exmaples using allof as well. |
@kenisteward I tried your new pr, but it doesn't seem to work. Are there any additional steps I have to perform to make it work? Can you show the allOf example that works for you? Thank you for your effort I appreciate it. ps. |
@HermenOtter the definitions section is copied right from what you gave.
|
@kenisteward Thank you very much for your effort. |
Has my pr been merged?
…On Thu, Nov 2, 2017, 9:35 AM Hermen Otter ***@***.***> wrote:
Closed #6822 <#6822>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6822 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMPLtSyIPu4VbJHQyvJpXzl_aYxhEO8Xks5sycU9gaJpZM4QHk5q>
.
|
Description
I think something went wrong when the enum generation recently changed. It currently generates empty names?
Swagger-codegen version
The current(time of writing) master (commit f78d958 ))
Swagger declaration file content or url
The defined enum:
Referenced in:
Results in:
Bug: The names are missing
Any ideas how to fix?
Command line used for generation
generate -i -l typescript-angular
The text was updated successfully, but these errors were encountered: