-
Notifications
You must be signed in to change notification settings - Fork 507
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
Error: Unknown type: TupleType #242
Comments
You're right. |
I'll close this for now. Let me know if you have any other questions. |
@endor I'm not sure why this was closed, the feature hasn't been added yet. |
@WoH made a great point:
So I’m not sure that we should support heterogenous/mixed-type tuples until OpenAPI supports heterogenous tuples. Here’s the issue thread that explains why OpenAPI can’t properly support heterogenous tuples: OAI/OpenAPI-Specification#1026 I will say that we could support homogeneous tuples like |
@dgreene1 can we reopen this given for discussion maybe?
I have to slightly disagree here. I agree it's not perfect to have slight inconsistencies here. I'd definitely want a description that communicates the order. However, not implementing this is not a better solution. It basically forces the API developer to accept anything (just like we would have to do) and check on their own, when a tuple could've been specified instead. At the end of the day, either tsoa or the developer will have to tell the api user that the order was not as expected (which can't be deduced from the spec alone in both cases. |
Do you mean "not support" as in error or just a warning? I don't think it's fair to error route generation just because a completely different feature doesn't support it. There's no additional processing required for heterogeneous tuples so as far as I can tell here, here and here would be the appropriate places for a check and potential warning/error, so non-swagger users are not affected. |
As I mentioned, I think that we should update the design goals of tsoa to clarify that we should not provide runtime validation that can not be communicated via Swagger/OpenAPI.
That description could become available if OAI/OpenAPI-Specification#1026 ratified/implemented. However, until that day we would be miscommunicating to the users. Currently the best we could do is: type: array
items:
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
minItems: 2
maxItems: 2 And that ^ has the (in my opinion) large issue of not clarifying the order. I feel like we would be encouraging users to use a type that is really ineffective at communicating to consumers what they need to send. And isn't communicating to consumers the whole point of having a Swagger/OpenAPI document? The only compromise I see would be to warn in all cases if a tuple is used:
If this compromise is acceptable, then I'm more open to dropping my proposed design goal (i.e. "that we shouldn't have runtime validations that OpenAPI can't document") for this particular case. I will re-open the issue if someone is interested in creating a PR that meets that acceptance criteria (and has unit tests that verify via test spies that the warnings are being written). |
I assume you only want this for heterogeneous tuples? Based on this comment I don't see a reason why homogeneous tuples wouldn't be possible in swagger 2.
That warning looks good to me.
I'll probably be able to do it once I know how to generate the swagger/open api part. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
It looks like support for Tuples in openapi 3 will land in 3.1.0: I see that RC0 was tagged in June. https://www.openapis.org/blog/2020/06/18/openapi-3-1-0-rc0-its-here Hopefully its coming soon! |
This is still a problem in v5.1.1.
causes:
|
Tuples appear to not be supported. Is this correct or a bug?
Error produced when trying to build swagger doc.
The text was updated successfully, but these errors were encountered: