@@ -47,6 +47,7 @@ import {
47
47
} from "@typespec/http" ;
48
48
import { isStream } from "@typespec/streams" ;
49
49
import {
50
+ getAccess ,
50
51
getAccessOverride ,
51
52
getAlternateType ,
52
53
getClientNamespace ,
@@ -783,6 +784,7 @@ function addDiscriminatorToModelType(
783
784
flatten : false , // discriminator properties can not be flattened
784
785
crossLanguageDefinitionId : `${ model . crossLanguageDefinitionId } .${ name } ` ,
785
786
decorators : [ ] ,
787
+ access : "public" ,
786
788
} ) ;
787
789
model . discriminatorProperty = model . properties [ 0 ] ;
788
790
}
@@ -1217,6 +1219,7 @@ export function getSdkCredentialParameter(
1217
1219
isApiVersionParam : false ,
1218
1220
crossLanguageDefinitionId : `${ getCrossLanguageDefinitionId ( context , client . service ) } .credential` ,
1219
1221
decorators : [ ] ,
1222
+ access : "public" ,
1220
1223
} ;
1221
1224
}
1222
1225
@@ -1253,6 +1256,7 @@ export function getSdkModelPropertyTypeBase(
1253
1256
crossLanguageDefinitionId : getCrossLanguageDefinitionId ( context , type , operation ) ,
1254
1257
decorators : diagnostics . pipe ( getTypeDecorators ( context , type ) ) ,
1255
1258
visibility : getSdkVisibility ( context , type ) ,
1259
+ access : getAccess ( context , type ) ,
1256
1260
} ) ;
1257
1261
}
1258
1262
@@ -1494,7 +1498,7 @@ interface PropagationOptions {
1494
1498
isOverride ?: boolean ;
1495
1499
}
1496
1500
1497
- function updateUsageOrAccess (
1501
+ export function updateUsageOrAccess (
1498
1502
context : TCGCContext ,
1499
1503
value : UsageFlags | AccessFlags ,
1500
1504
type ?: SdkType ,
@@ -1622,7 +1626,19 @@ function updateUsageOrAccess(
1622
1626
if ( property . kind === "property" && isReadOnly ( property ) && value === UsageFlags . Input ) {
1623
1627
continue ;
1624
1628
}
1625
- diagnostics . pipe ( updateUsageOrAccess ( context , value , property . type , options ) ) ;
1629
+ if ( typeof value === "number" ) {
1630
+ diagnostics . pipe ( updateUsageOrAccess ( context , value , property . type , options ) ) ;
1631
+ } else {
1632
+ // by default, we set property access value to parent. If there's an override though, we override.
1633
+ let propertyAccess = value ;
1634
+ if ( property . __raw ) {
1635
+ const propertyAccessOverride = getAccessOverride ( context , property . __raw ) ;
1636
+ if ( propertyAccessOverride ) {
1637
+ propertyAccess = propertyAccessOverride ;
1638
+ }
1639
+ }
1640
+ diagnostics . pipe ( updateUsageOrAccess ( context , propertyAccess , property . type , options ) ) ;
1641
+ }
1626
1642
options . ignoreSubTypeStack . pop ( ) ;
1627
1643
}
1628
1644
return diagnostics . wrap ( undefined ) ;
0 commit comments