Skip to content

Add apiTlsPolicy trait and OpenAPI mapper#3083

Open
mee-aa wants to merge 8 commits intosmithy-lang:mainfrom
mee-aa:add-api-tls-policy-trait
Open

Add apiTlsPolicy trait and OpenAPI mapper#3083
mee-aa wants to merge 8 commits intosmithy-lang:mainfrom
mee-aa:add-api-tls-policy-trait

Conversation

@mee-aa
Copy link
Copy Markdown
Contributor

@mee-aa mee-aa commented Apr 30, 2026

API Gateway REST APIs have a TLS security policy and an optional endpoint access mode that control the TLS version, cipher suite, and how the API endpoint can be accessed. These were previously only configurable via OpenAPI extensions.

Background

  • What do these changes do?
    • Add a new apiTlsPolicy structure trait to smithy-aws-apigateway-traits with a required securityPolicy string field and an optional endpointAccessMode enum field (BASIC or STRICT).
    • Add the corresponding OpenAPI mapper in smithy-aws-apigateway-openapi that writes securityPolicy to the x-amazon-apigateway-security-policy extension and endpointAccessMode to the x-amazon-apigateway-endpoint-access-mode extension as separate top-level entries, matching how API Gateway reads them at import time.
    • Add trait documentation in amazon-apigateway.rst and the OpenAPI conversion guide in converting-to-openapi.rst.
  • Why are they important?
    • Without this trait, customers had to use jsonAdd workarounds in smithy-build.json to configure TLS policies and endpoint access modes.
    • securityPolicy uses String (not an enum) because TLS policy values are actively expanding (e.g., SecurityPolicy_TLS13_* variants). endpointAccessMode uses an enum since only BASIC and STRICT are supported and unlikely to change.

Testing

  • Unit tests for the trait class: builder construction with all fields, required-field-only (optional absent), round-trip via Provider, factory registration
  • Test values varied across tests: legacy policies (TLS_1_0, TLS_1_2), enhanced policies (SecurityPolicy_TLS13_1_3_2025_09, SecurityPolicy_TLS13_1_2_2021_06), and both access modes (BASIC, STRICT)
  • Integration test for the OpenAPI mapper: loads a Smithy model with the trait applied, converts to OpenAPI, and verifies both extensions are present with correct values
  • All existing tests pass

Links


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mee-aa mee-aa requested a review from a team as a code owner April 30, 2026 22:51
@mee-aa mee-aa requested a review from yasmewad April 30, 2026 22:51
API Gateway REST APIs have a TLS security policy and an optional
endpoint access mode that control the TLS version, cipher suite,
and how the API endpoint can be accessed. These were previously
only configurable via OpenAPI extensions.

Add the `aws.apigateway#apiTlsPolicy` structure trait with a
required `securityPolicy` field and an optional
`endpointAccessMode` field. The OpenAPI mapper writes
`securityPolicy` to `x-amazon-apigateway-security-policy` and
`endpointAccessMode` to `x-amazon-apigateway-endpoint-access-mode`
as separate top-level extensions, matching how API Gateway reads
them at import time.
@mee-aa mee-aa force-pushed the add-api-tls-policy-trait branch from efad7a9 to e55d19e Compare April 30, 2026 22:52
Comment thread docs/source-2.0/aws/amazon-apigateway.rst
Comment thread docs/source-2.0/guides/model-translations/converting-to-openapi.rst Outdated
Comment thread .changes/next-release/feature-33d849c2a15d804a2753c7a4059be88b48cd9551.json Outdated
kstich
kstich previously approved these changes May 7, 2026
@kstich kstich self-requested a review May 7, 2026 20:56
@kstich kstich dismissed their stale review May 7, 2026 20:57

Missed something

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.

2 participants