Spec api code, imo. Feels like it's going backwards - there's really no reason why it has to be a .tsp, instead of a .ts with actual api code. It's even using @annotations. In fact the annotations i see in the screenshot (@route, @query, @path) are practically the same in NestJS. I feel that we should be focusing on enhancing that paradigm instead. In fact I already have a working POC of NestJS -> OpenAPI -> Client l…
TypeSpec: A new language for API-centric development
91–100 of 121 posts
Re: TypeSpec: A new language for API-centric development
#92Re: TypeSpec: A new language for API-centric development
#93Seems like this exists in a similar problem domain as pkl? https://pkl-lang.org/index.html
I might be wrong, but I suspect that the crazy hype-driven-development has started to move on from frontend to backend.
Re: TypeSpec: A new language for API-centric development
#94Seems like this exists in a similar problem domain as pkl? https://pkl-lang.org/index.html
Yeah, but this one is better because new. I might be wrong, but I suspect that the crazy hype-driven-development has started to move on from frontend to backend.
I wasn't alive in the 1970s, but I'm guessing that those who were would say it was just as faddish then as well.
Re: TypeSpec: A new language for API-centric development
#95Looks like a competitor/alternative to Smithy, https://smithy.io/2.0/index.html . Since at least one person from the TypeSpec team is here, do you have any thoughts on how they compare?
Re: TypeSpec: A new language for API-centric development
#96Earlier quoted context omitted.
If you can define single spec and autogenerate everything (client/server/OpenAPI et. al.), then spec first is superior. Looking at https://smithy.io/2.0/index.html which can already generate much more than TypeSpec based on the docs and awesome list.
I'm not sure how I can autogenerate non-trivial logic, which is my point. How would you handle a typical case where based on request data an endpoint fetches some additional information from various sources and depending on that performs several different actions? This is the most common scenario I've encountered outside of extremely trivial CRUD endpoints. EDIT: don't get me wrong, I'm not being purposefully obtuse…
It leaves the middleware library selection for the user, and with middleware you can do whatever more complex operations you need.
TypeScript server overview: https://smithy.io/2.0/ts-ssdk/introduction.html
> This execution flow allows the service developer to choose not only their endpoint, but the programming model of their service. For instance, all of the shim conversion and handler invocation can be refactored into a convenience method, or the service developer could choose to incorporate their favorite open source middleware library, of which the server SDK would simply be one layer. It also allows open-ended request preprocessing and response postprocessing to happen independent of Smithy. For instance, a developer could add support for request or response compression, or a custom authentication and authorization framework could be plugged into the application before the server SDK is invoked, without having to fight against a more heavyweight abstraction.
The Service type itself also seems to make it possible to define quite complex logic: https://smithy.io/2.0/spec/service-types.html
Re: TypeSpec: A new language for API-centric development
#97> At Microsoft, we believe in the value of using our own products, a practice often referred to as "dogfooding". One would think, unfortunely that is not how it looks like in the zoo of native Windows desktop development, or Xamarin/MAUI adoption in their mobile apps.
It must be a new policy, or maybe only for this product (which makes good marketing). I've used Microsoft Graph to manage emails, and I'd be very surprised if they use if for Outlook...
Re: TypeSpec: A new language for API-centric development
#98Re: TypeSpec: A new language for API-centric development
#99Re: TypeSpec: A new language for API-centric development
#100Feels like cheating, next to the yaml of openapi anything will look good. And that's all while I'm still considering openapi one of the best things that have happened. But I've also been kind of holding my breath for typescript making it's breakthrough as a schema language. More specifically its surprisingly big non-imperative, non-functional subset, obviously. And at first glance this seems to be exactly this, "what…
TypeScript type system is very advanced. It won't be possible to generate corresponding bindings for all popular languages, while keeping them idiomatic. I'd prefer API language to be very simple and straightforward.