File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import { SchemaPostProcessor } from '../models' ;
2+
3+ export const postProcessor : SchemaPostProcessor = ( _namespace : string , _apiVersion : string , schema : any ) => {
4+ const allowedValues = schema . definitions ?. ParameterDefinitionsValue ?. properties ?. allowedValues ;
5+ if ( allowedValues ) {
6+ const allowedValuesItems = allowedValues . oneOf [ 0 ] ?. items
7+ removeObjectType ( allowedValuesItems ) ;
8+ }
9+
10+ const defaultValue = schema . definitions ?. ParameterDefinitionsValue ?. properties ?. defaultValue ;
11+ removeObjectType ( defaultValue ) ;
12+
13+ const assignmentParameter = schema . definitions ?. PolicyAssignmentProperties ?. properties ?. parameters ;
14+ removeObjectType ( assignmentParameter ) ;
15+
16+ const definitionParameter = schema . definitions ?. PolicyDefinitionProperties ?. properties ?. parameters ;
17+ removeObjectType ( definitionParameter ) ;
18+
19+ const definitionReferenceParameter = schema . definitions ?. PolicyDefinitionReference ?. properties ?. parameters ;
20+ removeObjectType ( definitionReferenceParameter ) ;
21+
22+ const setDefinitionParameter = schema . definitions ?. PolicySetDefinitionProperties ?. properties ?. parameters ;
23+ removeObjectType ( setDefinitionParameter ) ;
24+ }
25+
26+ function removeObjectType ( property : any ) {
27+ if ( property && property [ 'type' ] && property [ 'type' ] === 'object' ) {
28+ delete property [ 'type' ] ;
29+ delete property [ 'properties' ] ;
30+ }
31+ }
32+
You can’t perform that action at this time.
0 commit comments