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

Typescript – Query parameters with oneOf schemas are not built #3969

Closed
azan-n opened this issue Jan 5, 2024 · 4 comments
Closed

Typescript – Query parameters with oneOf schemas are not built #3969

azan-n opened this issue Jan 5, 2024 · 4 comments
Assignees
Labels
Status: No Recent Activity TypeScript Pull requests that update Javascript code

Comments

@azan-n
Copy link

azan-n commented Jan 5, 2024

As part of my OpenAPI spec, I have multiple query parameters that are defined as the following:

"name": "createdAt",
"in": "query",
"description": "Date of creation",
"schema": {
  "oneOf": [
    {
      "type": "string",
      "description": "Matches values that are equal to a specified value.",
      "format": "date-time"
    },
    {
      "type": "object"
    }
  ],
  "properties": {
    "createdAt[eq]": {
      "type": "string",
      "description": "Matches values that are equal to a specified value.",
      "format": "date-time"
    },
    "createdAt[ne]": {
      "type": "string",
      "description": "Matches values that are not equal to a specified value.",
      "format": "date-time"
    },
    "createdAt[gt]": {
      "type": "string",
      "description": "Matches values that are greater than a specified value.",
      "format": "date-time"
    },
    "createdAt[gte]": {
      "type": "string",
      "description": "Matches values that are greater than or equal to a specified value.",
      "format": "date-time"
    },
    "createdAt[lt]": {
      "type": "string",
      "description": "Matches values that are less than a specified value.",
      "format": "date-time"
    },
    "createdAt[lte]": {
      "type": "string",
      "description": "Matches values that are less than or equal to a specified value.",
      "format": "date-time"
    }
  }
}

The Kiota-generated client for Typescript does not account for these. I'd be happy to submit a PR if needed.

@github-project-automation github-project-automation bot moved this to Todo in Kiota Jan 5, 2024
@baywet baywet self-assigned this Jan 9, 2024
@baywet baywet added question TypeScript Pull requests that update Javascript code labels Jan 9, 2024
@baywet baywet added this to the Backlog milestone Jan 9, 2024
@baywet
Copy link
Member

baywet commented Jan 9, 2024

Hi @azan-n,
Thanks for using kiota and for reaching out.
There are a couple of things happening here.
First off, union types are not yet supported for typescript as covered in #1812
Then, kiota in general (regardless of the language) doesn't project object query parameters as there's not consensus on how to serialize them.
Lastly, I think each of the properties in the description you've shared are meant to be query parameters of their own, and the current query parameter not be a union type but rather directly the first type of the oneOf.
Let us know if you have further questions.

@azan-n
Copy link
Author

azan-n commented Jan 15, 2024

Thank you so much for getting back @baywet.

Lastly, I think each of the properties in the description you've shared are meant to be query parameters of their own, and the current query parameter not be a union type but rather directly the first type of the oneOf.

I thought some more about the issue after posting and I had come to the same conclusion that we were probably complicating the query parameters in the spec for no good reason.

@baywet
Copy link
Member

baywet commented Jan 15, 2024

no worries. Is there anything additional here or can we close the issue?

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: No Recent Activity TypeScript Pull requests that update Javascript code
Projects
Archived in project
Development

No branches or pull requests

2 participants