Skip to content

Commit

Permalink
Merge pull request #1138 from nextcloud/fix/dynamite/security-schemes
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin authored Nov 14, 2023
2 parents 92ace09 + 6fd4329 commit 4864ced
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/dynamite/dynamite/lib/src/builder/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ final authentication = $client.authentications.firstWhereOrNull(
yield* securityRequirements.map((final requirement) {
final securityScheme = spec.components!.securitySchemes![requirement.keys.single]!;
final dynamiteAuth = toDartName(
'Dynamite-${securityScheme.type}-${securityScheme.scheme}-Authentication',
'Dynamite-${securityScheme.fullName.join('-')}-Authentication',
uppercaseFirstCharacter: true,
);
return '$dynamiteAuth()';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'package:collection/collection.dart';

part 'security_scheme.g.dart';

Expand All @@ -16,4 +17,10 @@ abstract class SecurityScheme implements Built<SecurityScheme, SecuritySchemeBui
String? get description;

String? get scheme;

String? get $in;

String? get name;

Iterable<String> get fullName => [type, scheme, $in, name].whereNotNull();
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ sealed class DynamiteAuthentication {
/// The base type of the authentication.
final String type;

/// The used authentication scheme.
final String scheme;
/// The used authentication HTTP scheme.
final String? scheme;

/// The authentication headers added to a request.
Map<String, String> get headers;
Expand Down

0 comments on commit 4864ced

Please sign in to comment.