OR

Orval

orval

A swagger client generator for typescript

Data Fetching
angular
axios
client
code-generation
data fetching
effect
fetch
hono
mock
msw
Stars
6.4k
Weekly
0
Open issues
52
Bundle
~60 kB

Installation

npm install orval

Code example

import { useOrval } from "orval";

export function Example() {
  const { data, isLoading, error } = useOrval({
    queryKey: ["example"],
    queryFn: () => fetch("/api/example").then((r) => r.json()),
  });

  if (isLoading) return <p>Loading…</p>;
  if (error) return <p>Could not load data.</p>;
  return <pre>{JSON.stringify(data, null, 2)}</pre>;
}

Pros & cons

Pros

  • Actively maintained by Victor Bury
  • 0 weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~60 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 52 open issues on GitHub

FAQs

Alternatives & similar libraries