pub fn patch(input_yaml: &str, config: &PatchConfig<'_>) -> Result<String>Expand description
Apply the configured transform pipeline to an OpenAPI YAML spec.
Parses the input YAML, applies all enabled transforms in the correct order, and returns the patched YAML string.
§Phase Ordering
The pipeline has ordering dependencies:
- Phase 1 (structural): 3.0 → 3.1 upgrade, server/info injection.
- Phase 2 (streaming): SSE annotations,
Last-Event-IDheader. - Phase 3 (responses): status codes, plain text, redirects, error
schemas,
201 Createdrewrite. - Phase 4 (enum rewrites): must run before inlining (phase 11) so that inlined schemas contain the rewritten enum values.
- Phase 5 (markers): unimplemented (
501) and deprecated flags; must run after response fixes (phase 3). - Phase 6 (security): bearer auth schemes; independent of validation.
- Phase 7 (cleanup): removes empty bodies before constraint injection.
- Phase 8 (UUID flattening): path template
.valuestripping,$refflattening, query param simplification; must run before validation. - Phase 9 (validation): constraint injection,
writeOnly/readOnlyannotation,Durationfield rewriting. - Phase 10 (path field stripping): must run after constraint injection (phase 9) since it clones schemas before removing path fields.
- Phase 11 (inlining): must run after path stripping (phase 10) to correctly detect emptied bodies; runs last among content transforms.
- Phase 12 (normalization): always runs last as a final cleanup pass.
§Errors
Returns an error if the input YAML cannot be parsed, processing fails,
or any deferred method name (from PatchConfig::unimplemented_methods
or PatchConfig::public_methods) cannot be resolved against proto metadata.