specprep

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command specprep prepares the vendored OpenAPI document for oapi-codegen.

oapi-codegen v2.8 reads OpenAPI 3.1 natively, so no 3.1 -> 3.0 downgrade is needed. Two deterministic rewrites keep its output correct and idiomatic; they change neither the operations nor the wire format:

  1. Validation-only unions are dropped. FastAPI emits object-level constraints such as `anyOf: [{required: [city]}, {required: [lat, lng]}]` ("a city or coordinates"). Every member only adds constraints, so the union describes validation, not shape (the other SDKs ignore it for typing too). oapi-codegen would otherwise turn the request into a union type whose MarshalJSON sends "field": null for every unset untyped field, which the API rejects.
  2. `const` schemas without a `type` get the type of their value, so a field such as `renderer: {const: "default"}` becomes an optional string enum rather than interface{}.
  3. In an `additionalProperties` union of two or more types plus `null`, the `null` member is dropped. oapi-codegen v2.8 would otherwise declare the map values as pointers but generate accessors for plain values, which does not compile. The union still decodes a JSON null (it keeps the raw value).

Usage: specprep IN OUT

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL