Repository navigation
openapi-codegen: classify operations for safe retry hooks - #68
Open
chrischeng-c4 wants to merge 1 commit into
Open
chrischeng-c4 wants to merge 1 commit into
chrischeng-c4 wants to merge 1 commit into
Conversation
…yClassIR Add RetryClassIR enum with SafeRead, IdempotencyKey, NonRetryable, and Unclassified variants. Parse operation's x-retry-class vendor extension into OperationIR.retry_class without inferring from HTTP method. Re-export RetryClassIR in api::ir::operations and add isolated unit tests in operations.rs.
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.
Closes #36
Summary of Changes
crates/openapi-codegen/src/domain/ir/operations.rs):pub enum RetryClassIR { SafeRead, IdempotencyKey, NonRetryable, Unclassified }withDefaultpointing toUnclassified.pub retry_class: RetryClassIRfield toOperationIR.build_one, extractedx-retry-classvendor extension fromop.extensionsand mapped:"safe-read"->RetryClassIR::SafeRead"idempotency-key"->RetryClassIR::IdempotencyKey"non-retryable"->RetryClassIR::NonRetryableRetryClassIR::Unclassified.is_query, or idempotency headers.crates/openapi-codegen/src/api/ir.rs):RetryClassIRalongsideOperationIRinapi::ir::operations.crates/openapi-codegen/src/domain/ir/operations.rs):retry_class_maps_known_extension_values: maps"safe-read","idempotency-key","non-retryable".retry_class_defaults_to_unclassified_when_missing: missing extension defaults toUnclassifiedacrossget,post,delete, andquery.retry_class_defaults_to_unclassified_for_unknown_or_non_string_values: unknown strings ("yes") and non-string values (true,42) default toUnclassified.retry_class_reads_extension_on_additional_operations: vendor extension honored onadditionalOperations.build_oneto setSafeReadforgetwhen missing extension failedretry_class_defaults_to_unclassified_when_missingat thegetassertion, and only rows expectingUnclassifiedfailed.Validation Evidence
cargo test --locked -p openapi-codegen --lib domain::ir::operations::tests:7 passed; 0 failed; 0 ignored; 102 filtered outcargo fmt -p openapi-codegen --check: clean exit 0.cargo check --locked -p openapi-codegen: clean exit 0.An unfiltered package test run (
cargo test --locked -p openapi-codegen) executed network/h2c/TLS suites, exhibiting partial failure on h2c connection tests and hanging ontls_alpn, and was terminated via task management (status:CANCELED). Per policy, local testing is strictly limited to isolated affected unit tests; package/integration tests belong in cloud CI.Local integration/h2c/server/network tests and full package suites are NOT RUN locally per confirmed test policy.