TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Microsoft TypeSpec

107 点作者 bundie8 个月前

18 条评论

9dev8 个月前
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.
评论 #41602868 未加载
评论 #41602709 未加载
评论 #41603048 未加载
评论 #41602867 未加载
评论 #41602902 未加载
评论 #41602694 未加载
recursivedoubts8 个月前
<i>&gt; Create a new TypeSpec project<p>&gt; Run the following command in a clean directory to create a new TypeSpec project.<p>&gt; tsp init<p>&gt; 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&#x2F;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&#x2F;RPC. All these so-called “REST-ful” APIs are really JSON plus RPC.
评论 #41604205 未加载
Alupis8 个月前
Eagerly awaiting AsyncAPI Support: <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;typespec&#x2F;issues&#x2F;2463">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;typespec&#x2F;issues&#x2F;2463</a><p>AsyncAPI support would make TypeSpec the end-all&#x2F;be-all API spec tool for a lot of people.<p>TypeSpec looks amazing - but until we can go &quot;all in&quot; on using it for both our external and internal API, it&#x27;s difficult for the team to justify yet another new DSL. It&#x27;s needs to support all of our common API definition woes, and currently it only addresses 50%.
bananaquant8 个月前
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:&#x2F;&#x2F;typespec.io&#x2F;docs&#x2F;standard-library&#x2F;built-in-data-types" rel="nofollow">https:&#x2F;&#x2F;typespec.io&#x2F;docs&#x2F;standard-library&#x2F;built-in-data-type...</a>:<p>* unixTimestamp32, but no 64-bit version<p>* plainDate that can be &quot;April 10th&quot; 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?
meindnoch8 个月前
How many times have we invented this particular wheel already?
评论 #41603921 未加载
评论 #41602955 未加载
评论 #41603059 未加载
coreyh144448 个月前
This came up a few months ago here: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=40206124">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=40206124</a>
kingkongjaffa8 个月前
If I’m a lowly nerdling writing a backend in express and typescript, what do I use this for?
评论 #41602963 未加载
评论 #41603187 未加载
gjmveloso8 个月前
It’s a lot of language for a DSL to define services. Smithy[1] sounds more balanced and extendable<p>[1]: <a href="https:&#x2F;&#x2F;smithy.io&#x2F;2.0&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;smithy.io&#x2F;2.0&#x2F;index.html</a>
unshavedyak8 个月前
Is there a good UI for this? I want to love OpenAPI but for complex JSON i&#x27;ve found OpenAPI UI&#x27;s to be unusable. At this point i&#x27;d hand write my API specifications if it meant i could have a useful UI.
评论 #41603164 未加载
drewda8 个月前
Originally this project also advertised support for GraphQL, but never implemented it: <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;typespec&#x2F;issues&#x2F;1390">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;typespec&#x2F;issues&#x2F;1390</a><p>Would be compelling to have a way to represent both OpenAPI and GraphQL in a common upstream schema...
评论 #41603060 未加载
ChrisArchitect8 个月前
Related April 2024:<p><i>Introducing TypeSpec: A New Language for API-Centric Development</i><p><a href="https:&#x2F;&#x2F;typespec.io&#x2F;blog&#x2F;2024-04-25-introducing" rel="nofollow">https:&#x2F;&#x2F;typespec.io&#x2F;blog&#x2F;2024-04-25-introducing</a><p>(<a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=40206124">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=40206124</a>)
henning8 个月前
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&#x27;t want to couple our persistence layer to our business logic or something<p>- add it to gRPC&#x2F;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&#x27;s full of people who talk about &quot;DRY&quot; who force you to repeat the same things over and over again, and this is &quot;clean code&quot;, and if you don&#x27;t like it, fuck you, you aren&#x27;t a &quot;culture fit&quot;. Utterly batshit insane.
评论 #41603500 未加载
评论 #41604028 未加载
activitypea8 个月前
The syntax leaves a bad first impression. I&#x27;m getting flashbacks to Java EE&#x2F;JAX-RS days.
andremedeiros8 个月前
What does this do that Protobuf doesn&#x27;t?
评论 #41603186 未加载
评论 #41602839 未加载
评论 #41602829 未加载
评论 #41602622 未加载
评论 #41602767 未加载
评论 #41602619 未加载
miohtama8 个月前
Looks nice!<p>Any recommendations for Python backend integration?
that70sshow8 个月前
why should one use this if both thrift and protobuf solves 90% of the needs.
mdaniel8 个月前
&gt; list(@query filter: string): Store[];<p>I despise &quot;hidden&quot; languages smuggled in string types. Both Microsoft &lt;<a href="https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;graph&#x2F;filter-query-parameter?tabs=http" rel="nofollow">https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;graph&#x2F;filter-query-paramet...</a>&gt; and Google &lt;<a href="https:&#x2F;&#x2F;google.aip.dev&#x2F;160" rel="nofollow">https:&#x2F;&#x2F;google.aip.dev&#x2F;160</a>&gt; 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&#x27;s possible should they taut their superiority over the existing, proven standards
paxys8 个月前
Normally I&#x27;m happy with efforts like these, but do we really need another standard? Just use OpenAPI directly folks.
评论 #41603364 未加载
评论 #41603449 未加载
评论 #41609084 未加载
评论 #41603331 未加载
评论 #41602944 未加载
评论 #41603175 未加载