-
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
Support for the unknown type #452
Comments
I’m creating this thread @WoH / @HoldYourWaffle due to the excellent guidance from the ElasticSearch contribution guidelines.
|
What is the expected representation of the unknown type on its own? |
That’s an excellent question @WoH
I agree that it would be strange to have an API return I’ll update the top of the issue to explain the context and value of the unknown type: Sometimes an API might allow the consumer to pass arbitrary data down to the service that will then be persisted in a schema-less DB like Mongo or PostGres’s JSONB. So as where the So I see it being most value with the @Body() decorator. |
Basically binary data? From the OpenAPI3 Spec: requestBody:
content:
application/octet-stream:
# any media type is accepted, functionally equivalent to `*/*`
schema:
# a binary file of any type
type: string
format: binary |
We document any like an object with unspecified properties, which is IMHO wrong and maybe should not be repeated.
Isn't |
No it’s not a mistake, it’s actually how swagger and OpenAPI 3 document the any type. See here: https://swagger.io/docs/specification/data-models/data-types/#any
Since an |
Do I sense some shade 😉
As an actual "input" to the discussion: what do you mean by aggregates in this context? |
No. Please assume best intentions. There is literally no shade or hard feelings. In fact, I care deeply about the tsoa community and the volunteers that work on it. Since your PR pointed out valuable improvements to the type resolver, I took the time to think of a feature enhancement that would give us a proper reason to refactor the type resolver code. I would prefer to stop talking about the philosophical aspects of refactoring. My main point here is (as it has always been): I can not spend time reviewing a PR that does not add functionality to the user (which Luke agrees on) or that fixes an issue that has been created and verified.
My availability to review PRs, merge PRs, and to publish new version of tsoa is very limited. I want to be very clear that conversations like the ones in the #445 PR take time away that I could be using to make tsoa a better library. That's why we will soon have "rules of the game" as part of our contribution guidelines. The rules I've set forth so far (i.e. having a real issue number that has been marked as "Help Wanted", having unit tests, etc.) are the contributor guidelines as long as I am the maintainer. In summary, I created this issue for you so that you would have mechanism by which to contribute within the guidelines. I'm doing this so that your contributions can be accepted and so that my time can be used efficiently.
I'm referring to the For convenience here's an example: type T22<T> = T & unknown; // T
type T23<T> = T | unknown; // unknown |
I did not know that and it's really valuable information, thank's a lot for pointing it out.
I should have clarified I did not mean JS existence. But since unknown may be |
As time consuming as it may have been (and it takes a lot of time for me to write my responses in somewhat OK-English), I did find it very insightful and I'm happy I got to see another point of view (no matter how much I disagree with some parts of it 😉)
I definitely agree that the original form of "that PR" was waaay too much effort to review, I honestly didn't even think of that. However, I can assure you that the issues+PR I'm going to create for my separated and atomic cleanups will be very easy to review. I'll make sure that everything has its own issue with reasoning and relevant diff information so you (or luke, he should probably get a say in this too) can simply click a link, look, switch tabs and say "yes" or "no", it'll probably take about 5 minutes per change including writing a response. Afterwards I'll make sure that everything is ready for merge. I hope that in this way we can make the type resolver more readable and accessible without a time consuming review process. I'm not trying to "push my opinion" here, I honestly believe that this cleanup is needed (at least some parts of it) and will provide long-term benefits. It feels to me like you're marking it as "not useful" or "not worth reviewing" upfront, but you haven't actually seen any of it yet. I only want it to at least get a fair review. Going back on-topic to the unknown type: I'll properly read myself into the material tomorrow (if I remember...). |
Current union/intersection should take care of that, making it (presumably) a lot easier to implement. Just add a validation for Current thoughts bringing type aliases into play here: |
Sounds lovely 😉 |
I'll remove the "feedback" label and add the "help wanted" label now that we've decided that:
|
@dgreene1 Can you please assign this to me so I don't forget? |
@HoldYourWaffle I don’t feel comfortable with the idea of reserving work. If someone else is able to provide a PR for this issue before you do and it meets all of the acceptance criteria, then that’s the one that we will accept. If we reserve this for you and you forget to do it, then all future contributors will ignore this PR and it won’t get done. If you you want a reminder, please use a personal reminder app like iOS’s Reminders, etc. |
The main reason I asked to be assigned is to avoid double work, the reason why you want these issues in the first place (which is a very good reason don't get me wrong). There is of course a risk that I won't get this done in a timely matter, I actually wouldn't be surprised given my aforementioned schedule. If that were to happen, you could just post a comment asking for a sign of life or even deassign me if I still don't respond. Stale bot can probably be configured to handle this automatically if it doesn't do this already. It's true that an issue being assigned can deteriorate contributors from working on it, which is kind of the idea in order to prevent double work. However, I feel like there are other, more important things in this project that deteriorates contributors, my most recent experience being that my comment on #458 was completely ignored. Since I've started contributing to this project I've felt hindered or unwanted almost every single step of the way. I understand what you're trying to do and I definitely understand that not everything can or should be added/implemented/... for various reasons. Not everything I've done was good of course (cough #445), but when you get this feeling even for trivial things like #447, #360, #365, #451 (#242) things stop being 'fun' really quickly, even when assuming best intentions. Maybe it's the language barrier or maybe it's just me being stupid or annoying, either way it makes me not want to contribute anymore. Because I depend on this project in production (with a use-case that requires some extra "help") and because I think it's childish to avoid improving something because you've had bad experiences with it in the past, I'll still contribute any improvements that I deem necessary for my use-case (which is currently mostly #451, #365 and a pending type resolver cleanup [this issue]). However, at least for now, the will to contribute to this project "for fun", e.g. just to make it better for others, is completely gone. |
I’m sorry that you feel that way. I really am. If you would like to submit code to help tsoa, that would be sincerely appreciated. |
Since I was very saddened by your message above, I wanted to take time to reflect on your feedback. @HoldYourWaffle here's a record of where all of the issues you presented are currently. I believe you'll see that I have done my best to be open minded. In all of the cases I have either:
CLI always requires a valid config for both swagger & routes #447
Contributor guidelines #458
Add option to change output filename #360
Allow aliased imports for parameter decorators #365
Tuple support #451
Summary:I've done my best to listen to everything you have said (including your complaints about As far as your concern for being "hindered," I have done my best to create an objective environment where everyone is treated fairly and equally by the same rigorous quality standards that a library of tsoa's popularity deserves. Quality gates can often be seen as hindering; however, I have also approved more tsoa PRs in the last month than have every been approved for tsoa. What I'm saying is that many contributors are finding tsoa to be a place where features can be added in an an "un-hindered" manner. I like to think that the increase in contributions and releases is due to the support and care I am putting into maintaining the tsoa community. I hope you can find a way to understand my sincere interest in making this an enjoyable and open place to contribute. |
First off, I want to apologize for the very late response, as I said before I'm currently working on a project with a somewhat tight deadline. I think the notifications for your comments didn't come through correctly, since I didn't notice them until stale bot commented on #446. I'll be responding to all your comments (at least those I could find) shortly. Next up, I'm really, terribly sorry I saddened you, this was nowhere near my intention and I hope you can forgive me for this. My comment was written in emotions of frustration and doubt, feeling like I'm not able to express myself correctly in my non-native language. I'll be responding to the rest of your comment tomorrow since it's very late and tired. I can say from experience that writing these sort of things doesn't go very well when I'm tired ;) |
I want to start by responding to the end of your comment:
I couldn't agree more, and I deeply appreciate and admire your interest and ability to listen and sometimes even change your mind after discussion on these important topics. On to the actual "material" here. Perhaps 'hindered' was not the right word to use, a certain kind of "resistance" would probably be a better description. I won't be going into detail about why I felt 'unwelcome' for each individual issue (unless you really want me to) because I don't think this matters anymore. I have already made up my mind about contributing to this project, and this probably won't change anytime soon. Please don't think this is "your fault" or anything like that, I have many reasons (some of which I haven't mentioned), most notably this next one: I think my vision on what this project is or should be is just too different from yours (most likely because I use it in a different way). I'd love to have an open discussion about this sometime (perhaps not in a github issue) since I'm interested in how other people use this amazing library. I've been thinking about creating a fork of this project that's more aligned with my use-case. (This is why all my PR's are coming from |
This is a proposal for the
unknown
type.Before anyone takes on this PR, we need to
Value that the
unknown
type offers:Sometimes an API might allow the consumer to pass arbitrary data down to the service that will then be persisted in a schema-less DB like Mongo or PostGres’s JSONB. So as where the
any
type has risks associate, theunknown
type more clearly communicates “I wouldn’t recommend trying to unwrap or utilize any subset of this data since it could have any shape or type.”The text was updated successfully, but these errors were encountered: