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

Inconsistent missing import of ParseNodeHelper #3399

Closed
andreaTP opened this issue Oct 2, 2023 · 4 comments
Closed

Inconsistent missing import of ParseNodeHelper #3399

andreaTP opened this issue Oct 2, 2023 · 4 comments
Assignees
Milestone

Comments

@andreaTP
Copy link
Contributor

andreaTP commented Oct 2, 2023

Description

With kiota 1.6.1 there are situations where, sometimes, the import of ParseNodeHelper is missing.

Reproducer

A minimal reproducer like this (coming from OpenAI OpenAPI spec):

openapi: 3.0.0
info:
  title: Test
  version: 1.0.0
  description: something
paths:
  /api/something/v1:
    post:
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  description:
                  example: "text-embedding-ada-002"
                  anyOf:
                    - type: string
                    - type: string
                      enum: ["text-embedding-ada-002"]
                input:
                  description: |
                    Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed the max input tokens for the model (8191 tokens for `text-embedding-ada-002`) and cannot be an empty string. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens.
                  example: "The quick brown fox jumped over the lazy dog"
                  oneOf:
                    - type: string
                      default: ""
                      example: "This is a test."
                    - type: array
                      items:
                        type: string
                        default: ""
                        example: "This is a test."
                    - type: array
                      minItems: 1
                      items:
                        type: integer
                      example: "[1212, 318, 257, 1332, 13]"
                    - type: array
                      minItems: 1
                      items:
                        type: array
                        minItems: 1
                        items:
                          type: integer
                      example: "[[1212, 318, 257, 1332, 13]]"
      responses:
        "200":
          description: "something"
          content:
            application/json: {}

emits (about 60-70% of the invocations, in Java) this snippet, in the file .../v1/V1PostRequestBody.java:

public static class V1 implements ComposedTypeWrapper, Parsable {
...
        public Map<String, java.util.function.Consumer<ParseNode>> getFieldDeserializers() {
            if (this.getV1Member1() != null) {
                return ParseNodeHelper.mergeDeserializersForIntersectionWrapper(this.getV1Member1());
            }
            return new HashMap<String, java.util.function.Consumer<ParseNode>>();
        }
...
}

without the corresponding using/import on the top of ParseNodeHelper.

Please, note that I'm unable to reproduce on top of the current main, but, I can notice that a bunch of getFieldDeserializers() generated methods are now returning empty maps, is it intended? Where can I look up the relevant changes?

Thanks a lot in advance! 🙏

@github-project-automation github-project-automation bot moved this to Todo in Kiota Oct 2, 2023
@baywet baywet self-assigned this Oct 2, 2023
@baywet baywet added this to the Backlog milestone Oct 2, 2023
@baywet
Copy link
Member

baywet commented Oct 2, 2023

The fixes I've applied in naming conventions for inline types most likely helped addressing this issue.
Can you expand on your last statement with the empty maps?

@andreaTP
Copy link
Contributor Author

andreaTP commented Oct 2, 2023

The fixes I've applied in naming conventions for inline types most likely helped addressing this issue.

Nice, can you link the relevant PR 🙏

Can you expand on your last statement with the empty maps?

I haven't really gone through the code properly, and I'm having issues reproducing as the behavior is really inconsistent across runs (this is likely caused by the idempotency issue).

@baywet
Copy link
Member

baywet commented Oct 2, 2023

#3340
#2953
#2782

This is also going to have an impact once I have a fix.
#2769

Let me know once you can pinpoint a repro.

@andreaTP
Copy link
Contributor Author

andreaTP commented Oct 2, 2023

Thanks for all the answers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants