fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
Apache License 2.0
2.69k stars 151 forks source link

feat(cli): Add support for in-lined path parameters #5231

Closed amckinney closed 1 day ago

amckinney commented 1 day ago

This adds support for including path-parameters in the request section of the endpoint definition. This includes:

  1. A new fern check rule which ensures that only one path-parameters block is present for any endpoint.
  2. The inline-path-parameters OpenAPI importer setting.

With this, both path-parameters formats are supported so that users can configure an endpoint like so:

service:
  auth: false
  base-path: /base/{baseParameter}
  path-parameters:
    fakeBaseParameter: string
  endpoints:
    legacy:
      path: /path/{parameter}/to/endpoint
      path-parameters:
        parameter: string
      method: POST

    inlined:
      path: /path/{parameter}/to/endpoint
      request:
        name: InlinedRequest
        path-parameters:
          parameter: string
      method: POST

Note that a new path-parameters test definition was added, and some generators might produce an in-lined request type alongside positional path parameters. This case should be handled within each generator with a generator-specific inlinePathParameters configuration option.

github-actions[bot] commented 1 day ago

🌿 Preview your docs: https://fern-preview-3c7b8175-11b0-4855-8484-34c0c66ea3c8.docs.buildwithfern.com/learn