NSwag VS orval

Compare NSwag vs orval and see what are their differences.

NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript. (by RicoSuter)

orval

orval is able to generate client with appropriate type-signatures (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification, either in yaml or json formats. 🍺 (by anymaniax)
Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
NSwag orval
39 20
6,482 2,257
- -
8.9 9.5
13 days ago 4 days ago
C# TypeScript
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

NSwag

Posts with mentions or reviews of NSwag. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-12-07.
  • This week I released v2.1 of my text-templating library Weave that now uses Source Generators by default.
    6 projects | /r/dotnet | 7 Dec 2023
    I'm mostly using it for C# API client generation from backend code - sort of similar to what a tool like NSwag Studio will do. I think NTypewriter has more flexibility though, and having a live view with the VS plugin makes development quick.
  • OpenAPI v4 Proposal
    24 projects | news.ycombinator.com | 31 May 2023
    NSwag does a wonderful job of generating TypeScript clients from OpenAPI specs. Definitely give it a shot before killing your current setup.

    https://github.com/RicoSuter/NSwag (It sucks in any OpenAPI yml, not just ones from Swashbuckle/C#)

  • Looking for an alternative to NSwag
    2 projects | /r/dotnet | 18 May 2023
  • The Typescript ecosystem is exhausting
    3 projects | /r/typescript | 14 May 2023
    I use this https://github.com/RicoSuter/NSwag but it's designed for .Net backends to some extent. But you can use the client generation from the command line or manually with the standalone client app.
  • Code generation from Swagger specification file
    2 projects | /r/dotnet | 22 Apr 2023
  • Tool for generating example API requests and responses from OpenAPI
    4 projects | /r/api | 3 Apr 2023
    Here are three tools that you can use to generate example API requests and responses from OpenAPI specifications. These tools should work well even if your schemas are deeply nested: Nswag (Command Line and GUI): Nswag is a Swagger/OpenAPI toolchain for .NET, TypeScript, and other platforms. It supports code generation, client generation, and API documentation. You can use NswagStudio, which is a graphical interface, or you can use the command line tool called "NSwag.exe" for generating example API requests and responses. GitHub: https://github.com/RicoSuter/NJsonSchema NswagStudio: https://github.com/RicoSuter/NSwag/wiki/NSwagStudio Dredd (Command Line): Dredd is a language-agnostic command-line tool for validating API descriptions against backend implementations. It supports OpenAPI, Swagger, and API Blueprint formats. Dredd can generate example requests and responses and validate whether your API implementation conforms to the API description. GitHub: https://github.com/apiaryio/dredd Documentation: https://dredd.org/en/latest/ Stoplight Studio (GUI): Stoplight Studio is a modern API design and documentation platform that supports OpenAPI and JSON Schema. It allows you to create, edit, and validate OpenAPI specifications and provides a powerful visual interface for generating example API requests and responses. Website: https://stoplight.io/studio/ GitHub: https://github.com/stoplightio/studio These tools should provide you with the ability to generate example API requests and responses from your OpenAPI specifications and handle deeply nested schemas.
  • Help me to generate swagger json Net 6
    1 project | /r/dotnetcore | 25 Feb 2023
  • Web API generate of swagger json file
    1 project | /r/dotnet | 21 Feb 2023
    I’ve got an ASP.NET Core web API - I integrate NSwag (which I prefer to Swashbuckle - personal preference), run the app locally to generate the actual JSON file. See https://github.com/RicoSuter/NSwag Then I have a Bicep file that creates the API from the OpenAPI specification. Sorry - I don’t do Terraform (most of the Azure samples are of Bicep, but it should be easy to convert).
  • Open API Generators for Typescript / Node?
    1 project | /r/webdev | 21 Jan 2023
    I have actually found that, but I was hoping for something with more popularity. E.g. this one is for .NET: https://github.com/RicoSuter/NSwag ( you can also generate typescript clients). But I do not want to bring in the dependency to another language, if possible.
  • Best practices of create models for back-end commutation.
    3 projects | /r/Angular2 | 26 Oct 2022
    If your API exposes a Swagger definition, you can use NSwag (https://github.com/RicoSuter/NSwag) to generate the TypeScript API Client and Models for you. We found this eliminates errors due to TS and API DTO’s not matching

orval

Posts with mentions or reviews of orval. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-04-15.
  • HonoJS: Small, simple, and ultrafast web framework for the Edges
    9 projects | news.ycombinator.com | 15 Apr 2024
    In cases where the client needs to stay separate, we have had a good experience with Orval[1] to generate a fully-typed @tanstack/query client from our OpenAPI spec.

    [1] https://orval.dev/

  • Litestar – powerful, flexible, and highly performant Python ASGI framework
    8 projects | news.ycombinator.com | 26 Feb 2024
    - Vite/React/Tailwind for the frontend, with [Orval](https://orval.dev/) to generate FE definitions based on the API spec.

    For non-API/SPA use-cases, it also has good HTML support, with built-in Jinja and HTMX integrations. The docs are great (https://docs.litestar.dev/latest/ - not quite Django-tier but that's the gold standard), however the reference application is a tad too complex imo (https://github.com/litestar-org/litestar-fullstack).

    https://github.com/litestar-org/awesome-litestar has a list of useful extensions - highly recommend trying it out if you are starting a new Python web project.

  • How to Automatically Consume RESTful APIs in Your Frontend
    13 projects | dev.to | 25 Jan 2024
    In order to generate the API client, there are a few options available, but we are going to use (Orval)[https://orval.dev]. Orval is a CLI tool that generates API clients based on an OpenAPI specification. It supports TypeScript, JavaScript, Axios, React, Vue, Angular and Svelte and it's highly customizable.
  • Getting the most out of vscode
    1 project | dev.to | 24 Jan 2024
    I would use "reveal": "never" if I don't care about the results of the command, for example, I generate swagger types using orval.dev on every folder open, but I want this to run in background as it's not that important, so I use "reveal": "never" for it.
  • Mock Service Worker(msw) releases 2.0
    8 projects | news.ycombinator.com | 23 Oct 2023
    we started using (and now contributing to) https://orval.dev/ this year which both generates the mocks using MSW as well as the client-side networking code (React Query in our case). It removes so much boilerplate its amazing.

    wrote up the basics of our workflow few weeks ago https://betaacid.co/blog/api-contracts

  • Ask HN: Why isn't JSON-RPC more widely adopted?
    11 projects | news.ycombinator.com | 2 Jan 2023
    Personally, find gRPC-Web very attractive but the current state of TypeScript/JS code-gen is very confusing and lacking.

    I would love something like https://orval.dev for gRPC-web. Have I missed something or is it just early to expect it?

    I tried a few libraries but couldn't get them to work or would generate unappealing results. I believe I'm hitting this issue with my local experiments. https://github.com/grpc/grpc-web/issues/535

  • I made a framework to build fully-typed RESTful server and client with zero dependency
    2 projects | /r/javascript | 20 Nov 2022
    This is a Library I've used in the past, https://github.com/anymaniax/orval
  • Best / Modern Test Stack for a new big Next.js project
    3 projects | /r/nextjs | 4 Nov 2022
    If you have OpenAPI specs to work with you could also use Orval (https://orval.dev/) to generate a lot of code. We’re just starting to evaluate it at work but so far the team that’s trialing it is liking it.
  • React & REST APIs: End-To-End TypeScript Based On OpenAPI Docs
    2 projects | /r/reactjs | 28 Oct 2022
    On the frontend we can use the OpenAPI docs to generate the TS types for our data structures. Not only types but fetch functions as well as react-query hook can be generated as well. And in this blog post you can see how to do that with a library called Orval.
  • React & REST APIs: End-To-End TypeScript Based On OpenAPI Docs
    2 projects | dev.to | 28 Oct 2022
    On this page, we’ll use a code generator called Orval.

What are some alternatives?

When comparing NSwag and orval you can also consider the following projects:

openapi-generator - OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)

openapi-typescript-codegen - NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification

autorest - OpenAPI (f.k.a Swagger) Specification code generator. Supports C#, PowerShell, Go, Java, Node.js, TypeScript, Python

jest-mock-extended - Type safe mocking extensions for Jest https://www.npmjs.com/package/jest-mock-extended

Refit - The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface.

react-query-auth - ⚛️ Authenticate your react applications easily with react-query.

swagger-ui - Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.

rtk-query - Data fetching and caching addon for Redux Toolkit

Polly - Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. From version 6.0.1, Polly targets .NET Standard 1.1 and 2.0+.

graphql-code-generator - A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.

protobuf-net.Grpc - GRPC bindings for protobuf-net and grpc-dotnet

such - A powerful fake data library, expandable, configurable, generate data exactly as you want.