Closed bkoelman closed 1 week ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 91.39%. Comparing base (
1053099
) to head (e9476b8
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This PR adds full support for using atomic operations with OpenAPI. Tests and examples using NSwag and Kiota are provided.
Various types have been renamed, which heavily affects generated clients. For example,
personPatchRequestDocument
is nowupdatePersonRequestDocument
, andpersonAttributesInPostRequest
has becomeattributesInCreatePersonRequest
. These renames were done because atomic operations are reusing existing schemas. As we're breaking big now (sorry), I did some extra cleanups in schema names. The easiest way to overcome that is to use target-typed new.Both
id
andlid
are exposed in all request types, to avoid an explosion of schema types. But this only happens when an operations controller is found. The effect is that you can send alid
in a post-resource request (which will be rejected by the server). Because of theid
/lid
distinction, separate schemas are generated for resource identifiers in requests and responses (sostaffMemberIdentifier
is replaced bystaffMemberIdentifierInRequest
andstaffMemberIdentifierInResponse
).Another change is that the
id
property has moved from the abstractdataInResponse
type into the resource-specific derived types. The effect is that you first need to upcast/type-check before getting access to theid
.Both NSwag and Kiota choke on the quotes in the
application/vnd.api+json; ext="https://jsonapi.org/ext/atomic"
media type, generating code that doesn't compile. Therefore, OpenAPI uses the relaxed variant introduced in #1553.The exposed operations in OpenAPI are based on the
GenerateControllerEndpoints
by default, but can be customized using your ownIAtomicOperationFilter
, a new feature that was introduced in #1561.The generation of
id
/lid
properties takesClientIdGenerationMode
into account for create-resource operations. Likewise, get-only or set-only attribute properties are hidden in the appropriate schemas.There is currently no way to send
null
/default
attribute values in an operations request with NSwag. This is tracked at #1577.Example usage:
Closes #1060.
QUALITY CHECKLIST