From 8c6a1ea1db9d600026b1003b00974a8f32635919 Mon Sep 17 00:00:00 2001 From: Matt Muller Date: Wed, 23 Aug 2023 17:40:33 -0400 Subject: [PATCH] Fix integ spec and ordering issue --- .../high_score_service/lib/high_score_service/auth.rb | 2 +- codegen/projections/white_label/lib/white_label/auth.rb | 2 +- codegen/projections/white_label/spec/auth_spec.rb | 2 ++ .../integration-specs/auth_spec.rb | 2 ++ .../ruby/codegen/generators/AuthResolverGenerator.java | 7 ++++--- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/codegen/projections/high_score_service/lib/high_score_service/auth.rb b/codegen/projections/high_score_service/lib/high_score_service/auth.rb index cf096f5b2..e4e2db264 100644 --- a/codegen/projections/high_score_service/lib/high_score_service/auth.rb +++ b/codegen/projections/high_score_service/lib/high_score_service/auth.rb @@ -14,8 +14,8 @@ module Auth SCHEMES = [ Hearth::AuthSchemes::HTTPApiKey.new, Hearth::AuthSchemes::HTTPBasic.new, - Hearth::AuthSchemes::HTTPDigest.new, Hearth::AuthSchemes::HTTPBearer.new, + Hearth::AuthSchemes::HTTPDigest.new, Hearth::AuthSchemes::Anonymous.new ].freeze diff --git a/codegen/projections/white_label/lib/white_label/auth.rb b/codegen/projections/white_label/lib/white_label/auth.rb index b2c41e179..a3505ec58 100644 --- a/codegen/projections/white_label/lib/white_label/auth.rb +++ b/codegen/projections/white_label/lib/white_label/auth.rb @@ -12,10 +12,10 @@ module Auth Params = Struct.new(:operation_name, keyword_init: true) SCHEMES = [ + Hearth::AuthSchemes::HTTPApiKey.new, Hearth::AuthSchemes::HTTPBasic.new, Hearth::AuthSchemes::HTTPBearer.new, Hearth::AuthSchemes::HTTPDigest.new, - Hearth::AuthSchemes::HTTPApiKey.new, Hearth::AuthSchemes::Anonymous.new ].freeze diff --git a/codegen/projections/white_label/spec/auth_spec.rb b/codegen/projections/white_label/spec/auth_spec.rb index 7036cd7a1..4d60ba8ee 100644 --- a/codegen/projections/white_label/spec/auth_spec.rb +++ b/codegen/projections/white_label/spec/auth_spec.rb @@ -270,6 +270,8 @@ module Auth expect(resolved).to eq(identity) resolved end + # temporarily disabled because not implemented + expect_any_instance_of(Hearth::Signers::HTTPDigest).to receive(:sign) client.http_digest_auth({}) end end diff --git a/codegen/smithy-ruby-codegen-test/integration-specs/auth_spec.rb b/codegen/smithy-ruby-codegen-test/integration-specs/auth_spec.rb index 7036cd7a1..4d60ba8ee 100644 --- a/codegen/smithy-ruby-codegen-test/integration-specs/auth_spec.rb +++ b/codegen/smithy-ruby-codegen-test/integration-specs/auth_spec.rb @@ -270,6 +270,8 @@ module Auth expect(resolved).to eq(identity) resolved end + # temporarily disabled because not implemented + expect_any_instance_of(Hearth::Signers::HTTPDigest).to receive(:sign) client.http_digest_auth({}) end end diff --git a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/AuthResolverGenerator.java b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/AuthResolverGenerator.java index 33bf318aa..2971919e2 100644 --- a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/AuthResolverGenerator.java +++ b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/AuthResolverGenerator.java @@ -15,6 +15,7 @@ package software.amazon.smithy.ruby.codegen.generators; +import java.util.Comparator; import java.util.HashSet; import java.util.Map; import java.util.Optional; @@ -103,9 +104,9 @@ private void renderAuthSchemesConstant(RubyCodeWriter writer) { writer .openBlock("SCHEMES = [") .call(() -> { - authTraitsSet.stream().forEach(trait -> { - renderAuthScheme(writer, trait); - }); + authTraitsSet.stream() + .sorted(Comparator.comparing(Trait::toShapeId)) + .forEach(trait -> renderAuthScheme(writer, trait)); }) .unwrite(",\n") .write("")