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

kiota 1.9.0 behaves strangely when generating for try.gitea swagger.v1.json #3901

Closed
Ibmurai opened this issue Dec 12, 2023 · 4 comments · Fixed by #3904
Closed

kiota 1.9.0 behaves strangely when generating for try.gitea swagger.v1.json #3901

Ibmurai opened this issue Dec 12, 2023 · 4 comments · Fixed by #3904
Assignees
Labels
generator Issues or improvements relater to generation capabilities. type:bug A broken experience WIP
Milestone

Comments

@Ibmurai
Copy link

Ibmurai commented Dec 12, 2023

When I run:

KIOTA_TUTORIAL_ENABLED=false kiota generate -l CSharp -d https://try.gitea.io/swagger.v1.json -o GiteaClient/ -c GiteaClient -n Mir.ClassLib.GiteaClient --ebc

For version 1.8.2 I get this:

warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/ - Multiple servers entries were found in the OpenAPI description. Only the first one will be used. The root URL can be set manually with the request adapter.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/CommitUser/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/CreateUserOption/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/EditUserOption/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/Email/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/Identity/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/PayloadUser/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/PullReviewComment/properties/original_position - The format uint64 is not supported by Kiota for the type integer and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/PullReviewComment/properties/position - The format uint64 is not supported by Kiota for the type integer and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/User/properties/email - The format email is not supported by Kiota and the string type will be used.
fail: Kiota.Builder.KiotaBuilder[0]
      OpenAPI error: #/paths//repos/{owner}/{repo}/git/commits/{sha}.{diffType} - The path signature '/repos/{}/{}/git/commits/{}' MUST be unique.
fail: Kiota.Builder.KiotaBuilder[0]
      OpenAPI error: #/paths//repos/{owner}/{repo}/pulls/{index}.{diffType} - The path signature '/repos/{}/{}/pulls/{}' MUST be unique.
warn: Kiota.Builder.KiotaBuilder[0]
      Omitted property reason for model WatchInfo in API path \repos\{owner}\{repo}\subscription, the schema is invalid.
warn: Kiota.Builder.KiotaBuilder[0]
      Omitted property content for model FileDeleteResponse in API path \repos\{owner}\{repo}\contents\{filepath}, the schema is invalid.
Generation completed successfully

For version 1.9.0 I get this:

warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/ - Multiple servers entries were found in the OpenAPI description. Only the first one will be used. The root URL can be set manually with the request adapter.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/CommitUser/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/CreateUserOption/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/EditUserOption/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/Email/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/Identity/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/PayloadUser/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/PullReviewComment/properties/original_position - The format uint64 is not supported by Kiota for the type integer and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/PullReviewComment/properties/position - The format uint64 is not supported by Kiota for the type integer and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/User/properties/email - The format email is not supported by Kiota and the string type will be used.
fail: Kiota.Builder.KiotaBuilder[0]
      OpenAPI error: #/paths//repos/{owner}/{repo}/git/commits/{sha}.{diffType} - The path signature '/repos/{}/{}/git/commits/{}' MUST be unique.
fail: Kiota.Builder.KiotaBuilder[0]
      OpenAPI error: #/paths//repos/{owner}/{repo}/pulls/{index}.{diffType} - The path signature '/repos/{}/{}/pulls/{}' MUST be unique.
warn: Kiota.Builder.KiotaBuilder[0]
      Omitted property content for model FileDeleteResponse in API path \repos\{repos-id}\{Owner-id}\contents\{filepath}, the schema is invalid.
warn: Kiota.Builder.KiotaBuilder[0]
      Omitted property reason for model WatchInfo in API path \repos\{repos-id}\{Owner-id}\subscription, the schema is invalid.
Generation completed successfully

The notable thing here is that 1.9.0 seems to invent path parameters {repos-id} and {Owner-id}, which are not defined in the swagger.v1.json

This gives problems with path parameters not mapping correctly to the URL template when using the generated library, since the template will reference these invented parameters, but the path parameters are set correctly (to owner and repo), so it will generate request strings like ...///... as opposed to .../some-owner/some-repo/...

@github-project-automation github-project-automation bot moved this to Todo in Kiota Dec 12, 2023
@baywet baywet self-assigned this Dec 13, 2023
@baywet baywet added type:bug A broken experience generator Issues or improvements relater to generation capabilities. labels Dec 13, 2023
@baywet baywet added this to the Kiota v1.10 milestone Dec 13, 2023
@baywet
Copy link
Member

baywet commented Dec 13, 2023

Thanks for reporting this. It seems to have been introduced by #3760 as pointed out by @ttoth89
I'll be looking into this shortly.

@baywet
Copy link
Member

baywet commented Dec 13, 2023

Hi everyone,
I've put together a fix for the issue at #3904 and we're discussing the possibility of a patch release so you don't have to wait the next minor release in January.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Kiota Dec 13, 2023
@Ibmurai
Copy link
Author

Ibmurai commented Dec 18, 2023

Hi @ramsessanchez & @baywet,

I've just tried with 1.9.1 and I'm still getting {repos-id} and {Owner-id} in the warnings when generating from try.gitea:

KIOTA_TUTORIAL_ENABLED=false kiota generate -l CSharp -d https://try.gitea.io/swagger.v1.json -o GiteaClient/ -c GiteaClient -n Mir.ClassLib.GiteaClient --ebc
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/ - Multiple servers entries were found in the OpenAPI description. Only the first one will be used. The root URL can be set manually with the request adapter.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/CommitUser/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/CreateUserOption/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/EditUserOption/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/Email/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/Identity/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/PayloadUser/properties/email - The format email is not supported by Kiota and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/PullReviewComment/properties/original_position - The format uint64 is not supported by Kiota for the type integer and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/PullReviewComment/properties/position - The format uint64 is not supported by Kiota for the type integer and the string type will be used.
warn: Kiota.Builder.KiotaBuilder[0]
      OpenAPI warning: #/components/schemas/User/properties/email - The format email is not supported by Kiota and the string type will be used.
fail: Kiota.Builder.KiotaBuilder[0]
      OpenAPI error: #/paths//repos/{owner}/{repo}/git/commits/{sha}.{diffType} - The path signature '/repos/{}/{}/git/commits/{}' MUST be unique.
fail: Kiota.Builder.KiotaBuilder[0]
      OpenAPI error: #/paths//repos/{owner}/{repo}/pulls/{index}.{diffType} - The path signature '/repos/{}/{}/pulls/{}' MUST be unique.
warn: Kiota.Builder.KiotaBuilder[0]
      Omitted property content for model FileDeleteResponse in API path \repos\{repos-id}\{Owner-id}\contents\{filepath}, the schema is invalid.
warn: Kiota.Builder.KiotaBuilder[0]
      Omitted property reason for model WatchInfo in API path \repos\{repos-id}\{Owner-id}\subscription, the schema is invalid.

@baywet
Copy link
Member

baywet commented Dec 18, 2023

yes, the parameters will still be renamed to avoid conflicts, but the parameter serialization name is now also corrected in the generated code. That was the main problem for requests failing in some cases:

  • uri template would be {baseUrl+}/foo/{foo-id}/bar
  • template name in the indexer would be foo
  • resolved result would be https://localhost/foo//bar

let us know if you still see mis-alignment in the generated code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generator Issues or improvements relater to generation capabilities. type:bug A broken experience WIP
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants