chore(deps): bump Microsoft.OpenApi 1.6.28 → 3.5.1 (#67)#152
Merged
Conversation
Refactors CSharpClientGenerator onto the v3.x model surface:
- Drop Microsoft.OpenApi.Readers (folded into Microsoft.OpenApi 3.x).
- Switch reader to OpenApiModelFactory.LoadAsync.
- Use IOpenApiSchema (the new model interface) where schemas are consumed
from the document; concrete OpenApiSchema is no longer the wire type.
- Replace schema.Reference != null with a GetRefId helper. $refs are now
modelled as a separate OpenApiSchemaReference class implementing
IOpenApiSchema, not as a Reference property on every schema.
- Replace string Type checks ('string', 'integer', …) with a SchemaTypeName
helper that maps the new JsonSchemaType [Flags] enum back to the legacy
OpenAPI 3.0 type strings, masking out the JsonSchemaType.Null bit
(which the v3 reader sets for OpenAPI 3.0 nullable: true).
- Replace OpenApiSchema.Nullable with an IsNullable helper that reads the
JsonSchemaType.Null bit (OpenAPI 3.1 nullability is type-array based).
- Replace OpenApiString enum value casts with JsonNode reading.
- Switch verb representation from the removed OperationType enum to
System.Net.Http.HttpMethod (the v3 model uses HttpMethod as the
PathItem.Operations dictionary key); the codegen string switch now
matches on HttpMethod.Method.
- Adjust Discriminator.Mapping value access — values are now
OpenApiSchemaReference, not raw $ref path strings.
Regression protection landed in #151 (810 unit tests covering public API
surface, model serialization round-trips, enum wire contracts, and
polymorphic dispatch). Generated/* is byte-identical against the committed
bundle on this branch (verified via bash scripts/build-local.sh — zero
drift), so the public API, JSON wire format, and dispatch tables are
provably unchanged.
All 810 unit tests pass on net8.0 and net10.0.
Refs: #67
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Upgrades the generator project to Microsoft.OpenApi 3.5.1 and refactors CSharpClientGenerator to the OpenAPI.NET 3.x model (schema references, schema typing/nullability, enum value reading, and HTTP verb representation), aiming to keep generated output stable.
Changes:
- Bump
Microsoft.OpenApifrom 1.6.28 to 3.5.1 and remove the separate Readers package. - Switch spec loading to
OpenApiModelFactory.LoadAsyncand refactor schema consumption toIOpenApiSchema+ reference/type/nullability helpers. - Replace
OperationTypeusage withSystem.Net.Http.HttpMethodand update method generation accordingly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Camunda.Orchestration.Sdk.Generator/Camunda.Orchestration.Sdk.Generator.csproj | Updates OpenAPI.NET dependency to 3.5.1 and drops Microsoft.OpenApi.Readers. |
| src/Camunda.Orchestration.Sdk.Generator/CSharpClientGenerator.cs | Refactors generator logic to OpenAPI.NET 3.x surface (document load, schema refs/types/nullability/enums, verb handling). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 1, 2026
…guard - HTTP verb switch now normalizes via ToUpperInvariant() and throws on unknown verbs instead of silently degrading to GET. Defends against any OpenAPI reader that might surface a non-canonical-cased HttpMethod (e.g. via a custom HttpMethod ctor). - Pre-compute isGetLiteral once from the normalized verb instead of comparing op.Verb against HttpMethod.Get reference instances at every EventualPoller call site (4 sites collapsed to one source of truth). - Replace 'p.Name ?? string.Empty' fallbacks (path + query params) with RequireParameterName helper that fails fast with operationId context. OpenAPI requires every parameter to declare a non-empty name; falling back to empty string would silently emit invalid C# identifiers and broken path/query assembly. Zero Generated/* drift; 810/810 tests pass on net8.0 and net10.0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactors
CSharpClientGeneratoronto theMicrosoft.OpenApi3.x model surface — the upgrade originally proposed in #45 that broke the build (#67).Why now
Regression protection landed in #151. With public API surface, model serialization round-trips, enum wire contracts, and polymorphic dispatch all locked by 810 unit tests, the refactor becomes a mechanical exercise: keep the suite green and
Generated/*byte-identical, and the change is provably non-regressive on the dimensions that matter to consumers.Changes
All edits are confined to
src/Camunda.Orchestration.Sdk.Generator/.Microsoft.OpenApi.Readers(folded intoMicrosoft.OpenApi3.x).OpenApiModelFactory.LoadAsync.IOpenApiSchema(the new model interface) where schemas are consumed from the document. The concreteOpenApiSchemais no longer the wire type for refs — referenced schemas flow through as a separateOpenApiSchemaReferenceclass.schema.Reference != nullwith aGetRefIdhelper that pattern-matches onOpenApiSchemaReference.Typechecks ("string","integer", …) with aSchemaTypeNamehelper that maps the newJsonSchemaType[Flags]enum back to the OpenAPI 3.0 type strings, masking out theJsonSchemaType.Nullbit (set by the v3 reader for OpenAPI 3.0nullable: true).OpenApiSchema.Nullablewith anIsNullablehelper that reads theJsonSchemaType.Nullbit (3.1 nullability is type-array based).OpenApiStringenum value casts withJsonNodereading.OperationTypeenum toSystem.Net.Http.HttpMethod(the v3 model usesHttpMethodas thePathItem.Operationsdictionary key); the codegen string switch now matches onHttpMethod.Method.Discriminator.Mappingvalue access — values are nowOpenApiSchemaReference, not raw\$refpath strings.Validation
bash scripts/build-local.sh— clean.Generated/*is byte-identical against the committed bundle on this branch (zero drift).dotnet build --configuration Release— clean.dotnet format --verify-no-changes— clean.dotnet test— 810 / 810 pass onnet8.0andnet10.0.Because
Generated/*is byte-identical, the public API, JSON wire format, polymorphic dispatch tables, and tenant-injection behaviour are provably unchanged.Closes #67. Supersedes #45.