Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@ts-rest/open-api
Advanced tools
Incrementally adoptable RPC-like client and server helpers for a magical end to end typed experience πͺ
ts-rest offers a simple way to define a contract for your API, which can be both consumed and implemented by your application, giving you end to end type safety without the hassle or code generation.
Easily define your API contract somewhere shared
const contract = c.contract({
getPosts: {
method: 'GET',
path: '/posts',
query: z.object({
skip: z.number(),
take: z.number(),
}), // <-- Zod schema
responses: {
200: c.type<Post[]>(), // <-- OR normal TS types
},
headers: z.object({
'x-pagination-page': z.coerce.number().optional(),
}),
},
});
Fulfill the contract on your server, with a type-safe router:
const router = s.router(contract, {
getPosts: async ({ params: { id } }) => {
return {
status: 200,
body: prisma.post.findUnique({ where: { id } }),
};
},
});
Consume the api on the client with a RPC-like interface:
const result = await client.getPosts({
headers: { 'x-pagination-page': 1 },
query: { skip: 0, take: 10 },
// ^-- Fully typed!
});
Create a contract, implement it on your server then consume it in your client. Incrementally adopt, trial it with your team, then get shipping faster.
MASSIVE Thanks to all of these wonderful people (emoji key), who have helped make ts-rest possible:
Since our first commit in 2022 we've been growing steadily. We're proud of our progress and we're excited about the future.
FAQs
Unknown package
The npm package @ts-rest/open-api receives a total of 38,380 weekly downloads. As such, @ts-rest/open-api popularity was classified as popular.
We found that @ts-rest/open-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.