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

Add support for comma-seperated list and union types in path and querystring params #2131

Open
nhtruong opened this issue Feb 7, 2024 · 2 comments

Comments

@nhtruong
Copy link

nhtruong commented Feb 7, 2024

We're working on describing OpenSearch API using Smithy. This API has a lot of comma-separated lists, and any unions (i.e. oneOf keyword in OpenAPI term) as schemas for Path and QueryString parameters. However Smithy currently doesn't allow:

  • List as a data model for Path params
  • Union as a data model for Path params
  • Union as a data model for QueryString params

Is there a way to bypass these restrictions? If not, can we add support for this use case?

@JordonPhillips
Copy link
Contributor

Can you give examples of how you would expect all of these to behave?

@JordonPhillips JordonPhillips added the response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 7 days. label Feb 20, 2024
@nhtruong
Copy link
Author

nhtruong commented Feb 22, 2024

For example, we have the following schemas in OpenAPI:

   Indices:
      oneOf:
        - $ref: '#/components/schemas/IndexName'
        - type: array
          items:
            $ref: '#/components/schemas/Index
   IndexName:
      type: string
      pattern: pattern: '^[a-zA-Z0-9][a-zA-Z0-9_]*$'

And we have this operation DELETE /{index} where {index} has Indices as its schema. Right now there's no way for us to describe this schema properly as an untagged union. As a workaround, we've tried to describe this path param as an array of IndexName but Smithy doesn't allow Lists in path names either. So we would end up with a lot of duct-tape to describe the data model in Smithy:

xDataType("string | string[]")
xMember("IndexName")
String Indices

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 7 days. label Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants