I just don’t get why they absolutely had to come up with new syntax. All of this would have been possible with standard Typescript, unlocking heaps of existing tooling, editor support, and prior knowledge. But no! Let’s come up with a new language, bespoke compiler, new LSP and IDE integrations, and make developers learn yet a new DSL.<p>It’s creating changes for the sake of creating changes.
<i>> Create a new TypeSpec project<p>> Run the following command in a clean directory to create a new TypeSpec project.<p>> tsp init<p>> This will prompt you with a few questions. Pick the Generic REST API template...</i><p>I’d just like to interject for a moment. What you’re referring to as REST, is, in fact, JSON/RPC, or as I’ve recently taken to calling it, JSON plus RPC. JSON is not a hypermedia unto itself, but rather a simple data format made useful by out of band information often specified with tools such as your TypeSpec project or similar.<p>Many computer users work with a canonical version of REST every day, without realizing it. Through a peculiar turn of events, the version of REST which is widely used today is often called “The Web”, and many of its users are not aware that it is basically the REST-ful architecture, defined by Roy Fielding.<p>There really is a REST, and these people are using it, but it is just a part of The Web they use. REST is the network architecture: hypermedia encodes the state of resources for hypermedia clients. JSON is an essential part of Single Page Applications, but is useless by itself; it can only function in the context of a complete API specification. JSON is normally used in combination with SPA libraries: the whole system is basically RPC with JSON added, or JSON/RPC. All these so-called “REST-ful” APIs are really JSON plus RPC.
Eagerly awaiting AsyncAPI Support: <a href="https://github.com/microsoft/typespec/issues/2463">https://github.com/microsoft/typespec/issues/2463</a><p>AsyncAPI support would make TypeSpec the end-all/be-all API spec tool for a lot of people.<p>TypeSpec looks amazing - but until we can go "all in" on using it for both our external and internal API, it's difficult for the team to justify yet another new DSL. It's needs to support all of our common API definition woes, and currently it only addresses 50%.
As someone mostly using compiled programming languages, I am perplexed about the built-in types that this new language provides.<p>According to <a href="https://typespec.io/docs/standard-library/built-in-data-types" rel="nofollow">https://typespec.io/docs/standard-library/built-in-data-type...</a>:<p>* unixTimestamp32, but no 64-bit version<p>* plainDate that can be "April 10th" without the year<p>* DefaultKeyVisibility, OmitDefaults.. what?<p>I am genuinely curious how did that happen. Design by committee? Some secret use cases that leaked into specification?
This came up a few months ago here: <a href="https://news.ycombinator.com/item?id=40206124">https://news.ycombinator.com/item?id=40206124</a>
It’s a lot of language for a DSL to define services. Smithy[1] sounds more balanced and extendable<p>[1]: <a href="https://smithy.io/2.0/index.html" rel="nofollow">https://smithy.io/2.0/index.html</a>
Is there a good UI for this? I want to love OpenAPI but for complex JSON i've found OpenAPI UI's to be unusable. At this point i'd hand write my API specifications if it meant i could have a useful UI.
Originally this project also advertised support for GraphQL, but never implemented it: <a href="https://github.com/microsoft/typespec/issues/1390">https://github.com/microsoft/typespec/issues/1390</a><p>Would be compelling to have a way to represent both OpenAPI and GraphQL in a common upstream schema...
Related April 2024:<p><i>Introducing TypeSpec: A New Language for API-Centric Development</i><p><a href="https://typespec.io/blog/2024-04-25-introducing" rel="nofollow">https://typespec.io/blog/2024-04-25-introducing</a><p>(<a href="https://news.ycombinator.com/item?id=40206124">https://news.ycombinator.com/item?id=40206124</a>)
Oh, so if I want to add a simple checkbox boolean field on a model on a proper best practices Clean Code Uncle Bob-approved code base in 2024, I have to:<p>- add it in the database model<p>- make a database migration for the field<p>- add it in the DTO for the API because we don't want to couple our persistence layer to our business logic or something<p>- add it to gRPC/Protobuf models so other services can call it<p>- add it to the new TypeSpec model thing<p>- update tests of all of the above<p>I love in tech 2024, it's full of people who talk about "DRY" who force you to repeat the same things over and over again, and this is "clean code", and if you don't like it, fuck you, you aren't a "culture fit". Utterly batshit insane.
> list(@query filter: string): Store[];<p>I despise "hidden" languages smuggled in string types. Both Microsoft <<a href="https://learn.microsoft.com/en-us/graph/filter-query-parameter?tabs=http" rel="nofollow">https://learn.microsoft.com/en-us/graph/filter-query-paramet...</a>> and Google <<a href="https://google.aip.dev/160" rel="nofollow">https://google.aip.dev/160</a>> are terrible about these embedded languages<p>Since Microsoft is one of the offenders, how about any novel type system try and model their own API and only when that's possible should they taut their superiority over the existing, proven standards