diff --git a/CLAUDE.md b/CLAUDE.md index b1cdb3f..e21c08e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -13,7 +13,7 @@ For engine annotations and the model artifact, read [model/README.md](model/READ Houses the `Options` data class (every plugin option lives here as a property with KDoc) and the `from(...)` factory that registers the `Annotations` + `google.api` extension registries before parsing the `CodeGeneratorRequest`. - [`compile/Compiler.kt`](src/main/kotlin/com/engine/protoc/openapi/compile/Compiler.kt) — internal compiler. `compile()` dispatches to `compileMerged()` or `compileUnmerged()` based on `options.merge`. -- [`compile/`](src/main/kotlin/com/engine/protoc/openapi/compile) — supporting builders and indices: `SchemaBuilder`, `PathsBuilder`, `MessageIndex`, `EnumIndex`, `RpcIndex`, `SchemaKeyResolver`, plus the `json/` serializers. +- [`compile/`](src/main/kotlin/com/engine/protoc/openapi/compile) — supporting builders and indices: `SchemaBuilder`, `PathsBuilder`, `Descriptions` (every emitted description/summary/title: reference-link resolution and plain-text scrubbing), `MessageIndex`, `EnumIndex`, `RpcIndex`, `SchemaKeyResolver`, plus the `json/` serializers. ## Working Reminders diff --git a/README.md b/README.md index e515ef9..168ee1e 100644 --- a/README.md +++ b/README.md @@ -96,33 +96,35 @@ Click the option name to jump to its KDoc for full semantics, precedence rules, | name | type | default | summary | |---|---|---|---| -| [`alwaysPrintPrimitiveFields`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L266) | boolean | `false` | Add every non-repeated, non-message field to `required`. Pair with Envoy's `always_print_primitive_fields`. | -| [`autoMapping`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L251) | boolean | `false` | Auto-map gRPC methods without a `google.api.http` annotation to `POST /./`. Mirrors Envoy's `auto_mapping`. | -| [`autoTagServices`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L116) | boolean | `false` | Tag every operation with its enclosing service name and emit a top-level `tags` entry per service using the service's proto comment as the description. | -| [`convertGrpcStatus`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L309) | boolean | `false` | Add a `"default"` response entry to every operation whose JSON body is an inline `google.rpc.Status` schema. Mirrors Envoy's `convert_grpc_status`. | -| [`enumValueFormat`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L232) | enum | `CANONICAL` | How enum values are written into OAS `enum` arrays: `CANONICAL`, `NUMERIC_VALUE`, or `LOWER_CASE`. Pair with Envoy's `always_print_enums_as_ints` / `case_insensitive_enum_parsing`. | -| [`inlineEnums`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L180) | boolean | `false` | Emit enum values inline at every reference instead of as a shared `$ref` in `components/schemas`. | -| [`inlineRequestSchemas`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L198) | boolean | `true` | Global default for inlining each RPC's request body schema at the use site. Per-method `inline_request` annotation overrides. | -| [`inlineResponseSchemas`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L210) | boolean | `true` | Global default for inlining each RPC's response body schema at the use site. Per-method `inline_response` annotation overrides. | -| [`logFile`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L365) | string | — | File path the SLF4J binding writes records to. When unset, records go to standard error. | -| [`logLevel`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L353) | enum | `ERROR` | SLF4J threshold (`TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`) applied to every logger the plugin and its dependencies create. | -| [`merge`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L36) | boolean | `false` | Combine every service across every target file into a single OpenAPI document instead of one document per service. | -| [`outputFormat`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L99) | enum | `JSON` | Serialization format of generated documents: `JSON` (default) or `YAML`. | -| [`preserveProtoFieldNames`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L285) | boolean | `false` | Use raw proto field names (e.g. `my_field`) as schema property keys instead of `json_name` or lowerCamelCase. Pair with Envoy's `preserve_proto_field_names`. | -| [`referenceLinkTarget`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L439) | enum | `NONE` | Renderer dialect that CommonMark reference links (`[Type]`, `[Service.Method]`) in `description` fields resolve to: `NONE` (default — resolution off, brackets untouched), `SWAGGER_UI` (operations + tags), or `REDOC` (operations + tags + generated schema sections). When resolution is enabled, unresolved references are stripped of their brackets and rendered as an inline code span (`` `Property` ``), with a warning. | -| [`schemaNamespaceCasing`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L145) | enum | `NONE` | Case transformation applied to package segments of a namespaced schema key. `NONE`, `CAPITALIZED`, or `UPPER_CASE`. | -| [`schemaNamespaceSeparator`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L136) | enum | `NONE` | Separator placed between package segments of a namespaced schema key. `NONE`, `UNDERSCORE`, `DASH`, or `DOT`. | -| [`schemaNamespaceStrategy`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L129) | enum | `NONE` | Controls which package segments are prepended to schema keys in `components/schemas`. `NONE`, `FULL_PACKAGE`, or `SIMPLIFIED_PACKAGE`. | -| [`schemaNamespaceVersionExtraction`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L156) | boolean | `false` | Move package segments that look like proto API version identifiers (e.g. `v1`, `v2beta1`) to the end of the schema key. | -| [`serviceExclude`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L403) | regex | — | Exclude services whose fully-qualified name contains a match, even if they also matched `serviceInclude`. | -| [`serviceInclude`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L390) | regex | `^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)*$` | Only include services whose fully-qualified name contains a match. Schemas referenced only by excluded services are also omitted. | -| [`setSchemaTitleToProtoSimpleName`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L169) | boolean | `false` | Add a `"title"` field to each schema in `components/schemas` set to the unqualified proto type name. | -| [`streamNewlineDelimited`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L324) | boolean | `false` | Document server-streaming responses with content-type `application/x-ndjson`. Mirrors Envoy's `stream_newline_delimited`. | -| [`streamSseStyleDelimited`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L339) | boolean | `false` | Document server-streaming responses with content-type `text/event-stream`. Mirrors Envoy's `stream_sse_style_delimited`. Takes precedence over `streamNewlineDelimited`. | -| [`suppressDefaultEnumValues`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L221) | boolean | `false` | Omit enum values whose proto number is `0` (the proto3 default value convention) from all OAS enum value lists. | -| [`validateOutput`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L68) | boolean | `false` | Validate each generated document against the official OAS 3.1.1 schema. Issues are logged at `WARN`. See [`validationErrorsAreFatal`](#L88) to also fail the compile. | -| [`validationErrorsAreFatal`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L88) | boolean | `false` | When `true`, validation issues are also written to the protoc error and fail the compile. No effect unless `validateOutput` is also `true`. | -| [`version`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L54) | string | — | Fallback `info.version` for documents whose annotations do not specify one. | +| [`alwaysPrintPrimitiveFields`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L269) | boolean | `false` | Add every non-repeated, non-message field to `required`. Pair with Envoy's `always_print_primitive_fields`. | +| [`autoMapping`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L254) | boolean | `false` | Auto-map gRPC methods without a `google.api.http` annotation to `POST /./`. Mirrors Envoy's `auto_mapping`. | +| [`autoTagServices`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L119) | boolean | `false` | Tag every operation with its enclosing service name and emit a top-level `tags` entry per service using the service's proto comment as the description. | +| [`convertGrpcStatus`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L312) | boolean | `false` | Add a `"default"` response entry to every operation whose JSON body is an inline `google.rpc.Status` schema. Mirrors Envoy's `convert_grpc_status`. | +| [`enumValueFormat`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L235) | enum | `CANONICAL` | How enum values are written into OAS `enum` arrays: `CANONICAL`, `NUMERIC_VALUE`, or `LOWER_CASE`. Pair with Envoy's `always_print_enums_as_ints` / `case_insensitive_enum_parsing`. | +| [`inlineEnums`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L183) | boolean | `false` | Emit enum values inline at every reference instead of as a shared `$ref` in `components/schemas`. | +| [`inlineRequestSchemas`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L201) | boolean | `true` | Global default for inlining each RPC's request body schema at the use site. Per-method `inline_request` annotation overrides. | +| [`inlineResponseSchemas`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L213) | boolean | `true` | Global default for inlining each RPC's response body schema at the use site. Per-method `inline_response` annotation overrides. | +| [`logFile`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L372) | string | — | File path the SLF4J binding writes records to. When unset, records go to standard error. | +| [`logLevel`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L360) | enum | `ERROR` | SLF4J threshold (`TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`) applied to every logger the plugin and its dependencies create. | +| [`merge`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L39) | boolean | `false` | Combine every service across every target file into a single OpenAPI document instead of one document per service. | +| [`outputFormat`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L102) | enum | `JSON` | Serialization format of generated documents: `JSON` (default) or `YAML`. | +| [`preserveProtoFieldNames`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L288) | boolean | `false` | Use raw proto field names (e.g. `my_field`) as schema property keys instead of `json_name` or lowerCamelCase. Pair with Envoy's `preserve_proto_field_names`. | +| [`referenceLink`](src/main/kotlin/com/engine/protoc/openapi/ProtocGenOpenAPI.kt#L481) | `