@@ -5,20 +5,6 @@ import { ResourceReference } from './reference-props';
55import { log } from '../util' ;
66import { SelectiveImport } from './service-submodule' ;
77
8- /**
9- * We currently disable the relationship on the properties of types because they would create a backwards incompatible change
10- * by broadening the output type as types are used both in input and output. This represents:
11- * Relationship counts:
12- * Resource-level (non-nested): 598
13- * Type-level (nested): 483 <- these are disabled by this flag
14- * Total: 1081
15- * Properties with relationships:
16- * Resource-level (non-nested): 493
17- * Type-level (nested): 358
18- * Total: 851
19- */
20- export const GENERATE_RELATIONSHIPS_ON_TYPES = false ;
21-
228/**
239 * Represents a cross-service property relationship that enables references
2410 * between resources from different AWS services.
@@ -41,7 +27,24 @@ export class RelationshipDecider {
4127 private readonly namespace : string ;
4228 public readonly imports = new Array < SelectiveImport > ( ) ;
4329
44- constructor ( readonly resource : Resource , private readonly db : SpecDatabase , private readonly enableRelationships = true ) {
30+ constructor (
31+ readonly resource : Resource ,
32+ private readonly db : SpecDatabase ,
33+ public readonly enableRelationships = true ,
34+ /**
35+ * We currently disable the relationship on the properties of types because they would create a backwards incompatible change
36+ * by broadening the output type as types are used both in input and output. This represents:
37+ * Relationship counts:
38+ * Resource-level (non-nested): 598
39+ * Type-level (nested): 483 <- these are disabled by this flag
40+ * Total: 1081
41+ * Properties with relationships:
42+ * Resource-level (non-nested): 493
43+ * Type-level (nested): 358
44+ * Total: 851
45+ */
46+ public readonly enableNestedRelationships = false ,
47+ ) {
4548 this . namespace = namespaceFromResource ( resource ) ;
4649 }
4750
@@ -146,7 +149,7 @@ export class RelationshipDecider {
146149 * Checks if a given property needs a flattening function or not
147150 */
148151 public needsFlatteningFunction ( propName : string , prop : Property , visited = new Set < string > ( ) ) : boolean {
149- if ( ! GENERATE_RELATIONSHIPS_ON_TYPES ) {
152+ if ( ! this . enableNestedRelationships ) {
150153 return false ;
151154 }
152155 if ( this . hasValidRelationships ( propName , prop . relationshipRefs ) ) {
0 commit comments