Skip to content

Generate an OpenAPI specification from your Fern specification

License

Notifications You must be signed in to change notification settings

crashdump/fern-openapi

 
 

Repository files navigation


header

OpenAPI Generator

Contributors Pulls-opened Pulls-merged

Discord

The OpenAPI specification, or OAS, defines a standard, language-agnostic interface to HTTP APIs which allows both humans and computers to discover and understand the capabilities of the service.

This repository contains the source for the Fern generator that produces an OpenAPI specification:

  • fernapi/fern-openapi

The generator is written in TypeScript and produces an OpenAPI 3.0.0 specification. If you have a need for Fern to generate a more recent specification version, let us know in this issue.

Fern handles transforming a Fern specification into Fern intermediate representation. IR is a normalized, Fern-specific definition of an API containing its endpoints, models, errors, authentication scheme, version, and more. Then the OpenAPI generator takes over and turns the IR into a production-ready OpenAPI specification.

What is Fern?

Fern is an open source toolkit for designing, building, and consuming REST APIs. With Fern, you can generate client libraries, API documentation, and boilerplate for your backend server.

Head over to the official Fern website for more information, or head over to our Documentation to dive straight in and find out what Fern can do for you!

Generating an OpenAPI specification

This generator is used via the Fern CLI by defining the OpenAPI generator:

- name: fernapi/openapi
  version: 0.0.28
  output:
    location: local-file-system
    path: ../../generated/openapi

By default, Fern runs the generators in the cloud. To run a generator on your local machine, use the --local flag for fern generate. This will run the generator locally in a Docker container, allowing you to inspect its logs and output. Read more.

Releases

All generator releases are published in the Releases section of the GitHub repository. You can directly use these version numbers in your generator configuration files.

For instance, if you want to use version 0.0.27 of the OpenAPI generator:

default-group: local
groups:
  local:
    generators:
      - name: fernapi/fern-openapi
        version: 0.0.27
        output:
          location: local-file-system
          path: ../../generated/openapi

Fern will handle the rest automatically.

Contributing

We greatly value community contributions. All the work on Fern generators happens right here on GitHub, both Fern developers and community contributors work together through submitting code via Pull Requests. See the contribution guidelines in CONTRIBUTING on how you can contribute to Fern!

About

Generate an OpenAPI specification from your Fern specification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 91.0%
  • JavaScript 6.3%
  • Shell 2.4%
  • Dockerfile 0.3%