Skip to content

Upgrade to OpenAPI 3.1.0 support#20

Open
charliekump-wf wants to merge 2 commits into
PatOConnor43:masterfrom
charliekump-wf:upgrade-openapi-3.1
Open

Upgrade to OpenAPI 3.1.0 support#20
charliekump-wf wants to merge 2 commits into
PatOConnor43:masterfrom
charliekump-wf:upgrade-openapi-3.1

Conversation

@charliekump-wf

Copy link
Copy Markdown

Summary

  • Migrate from openapiv3 crate (3.0.x only) to oas3 crate (v0.21) which natively supports OpenAPI 3.1.0
  • Rewrite schema handling for oas3's flat ObjectSchema model vs openapiv3's SchemaKind enum
  • Update all test fixtures from openapi: 3.0.2 to openapi: 3.1.0 and regenerate snapshots

Test plan

  • All 10 existing tests pass (cargo test)
  • Clean build with warnings-as-errors (RUSTFLAGS="-Dwarnings" cargo build)
  • Manual smoke test with a real OpenAPI 3.1.0 spec
  • Verify generated .hurl files are functionally equivalent

🤖 Generated with Claude Code

Migrate from `openapiv3` crate (3.0.x only) to `oas3` crate which
natively supports OpenAPI 3.1.0. This is a breaking change for the
parsing library but preserves all existing functionality.

Key changes:
- Replace openapiv3 with oas3 v0.21 (includes built-in YAML support)
- Rewrite schema handling for oas3's flat ObjectSchema model vs
  openapiv3's SchemaKind enum
- Update all test fixtures from openapi 3.0.2 to 3.1.0
- Update snapshots for property ordering and schema kind changes

@raphaeladam-wf raphaeladam-wf left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+10000000000

@patbot Merge :trollface:

@PatOConnor43 PatOConnor43 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple questions for you

Comment thread src/main.rs Outdated
Comment thread src/main.rs
}
};

match primary_type {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation is probably fine on the request side since the user will almost definitely need to make changes to the body and adding both potential types to the body is nonsense.

path: "/pets",
},
kind: "Any",
kind: "OneOf",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all of these snapshots where the kind of the diagnostic changed are indicative of different behavior? Shouldn't this continue to return Any as the name of the file implies?

#jsonpath "$.category" isCollection
#jsonpath "$.category.id" isInteger
#jsonpath "$.category.name" isString
#jsonpath "$.id" isInteger

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alphabetized output on asserts is an acceptable change for the snapshots 👍

- Revert all existing test fixtures back to openapi 3.0.2, preserving
  the original OAS 3.0 test suite and snapshots
- Fix multi-composition-keyword handling: when multiple composition
  keywords (oneOf/allOf/anyOf) are present simultaneously, emit
  UnsupportedSchemaKind("Any") diagnostic instead of silently processing
  the first one found
- Fix multi-type assert generation: when a schema has multiple non-null
  types (e.g. type: ["integer", "string"]), generate commented-out
  assert alternatives for each type so the user can pick
- Add separate OAS 3.1 test fixtures and tests (oas31_petstore,
  oas31_diagnostic_inputs) exercising 3.1 features like nullable types
  and multi-type schemas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants