Skip to content
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

[TS] Enum default value deserialization #4216

Closed
lroos opened this issue Feb 22, 2024 · 1 comment · Fixed by #4217
Closed

[TS] Enum default value deserialization #4216

lroos opened this issue Feb 22, 2024 · 1 comment · Fixed by #4217
Assignees
Labels
help wanted Issue caused by core project dependency modules or library type:bug A broken experience TypeScript Pull requests that update Javascript code
Milestone

Comments

@lroos
Copy link
Contributor

lroos commented Feb 22, 2024

I have an OpenAPI type definition geography with an enum field type that has a default value States:

"geography": {
  "type": "object",
  "properties": {
    "type": {
      "default": "States",
      "enum": ["States","Counties", ...],

I see a build error in the generated TypeScript client model code line in /client/models/index.ts in the method deserializeIntoGeography ('Geography_type' only refers to a type, but is being used as a value):

"type": n => { geography.type = n.getEnumValue<Geography_type>(Geography_typeObject) ?? Geography_type.States; },

and I am able to fix it by changing it to:

"type": n => { geography.type = n.getEnumValue<Geography_type>(Geography_typeObject) ?? Geography_typeObject.States; },

using Kiota dotnet tool version 1.11.1+86b3a623dc3fb6b55fed6a49519ec837f0fbc02c

lroos added a commit to lroos/kiota that referenced this issue Feb 22, 2024
@baywet baywet added type:bug A broken experience help wanted Issue caused by core project dependency modules or library TypeScript Pull requests that update Javascript code labels Feb 22, 2024
@baywet baywet added this to the Kiota v1.12 milestone Feb 22, 2024
@lroos
Copy link
Contributor Author

lroos commented Feb 23, 2024

FYI traced this to a regression in v1.9.1 #3862

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issue caused by core project dependency modules or library type:bug A broken experience TypeScript Pull requests that update Javascript code
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants