OpenAPIOutput.fromJson constructor
Wraps decoded JSON.
Implementation
factory OpenAPIOutput.fromJson(Map<String, Object?> json) {
final type = requireString(json, 'type', scope: 'openapi.output');
final path = requireString(json, 'path', scope: 'openapi.output');
return switch (type) {
'route' => OpenAPIOutput.route(path),
'local' => OpenAPIOutput.local(path),
_ => throw FormatException(
'Invalid openapi.output.type: expected `route` or `local`.',
),
};
}