以下是我的示例JSON文件。
- 遍历所有唯一属性
- 对于每个唯一属性,检查“x-visibility”:“Private”对象的值。如果这是“Private”,则删除整个对象。
foreach ($p in $apijson.paths.PSObject.Properties.Value) {
$get = $p.get.'x-qlik-visibility' -eq 'Private'
if ($get -eq 'True') {
Write-Host 'Removing Object :'$p
# Remove-ItemProperty -Name $p.get
$apijsonNew.PSObject.Properties.Remove($p)
}
}
{
"swagger": "2.0",
"info": {
"title": "Open API specification for Repository Main API",
"version": "20.8.0"
},
"basePath": "/qrs",
"schemes": [
"https"
],
"paths": {
"/about/api/default/analyticconnection": {
"get": {
"operationId": "2b781738-afd0-37a9-4248-84ec8d6be58c",
"parameters": [
{
"name": "listentries",
"in": "query",
"required": false,
"default": true,
"type": "boolean",
"allowEmptyValue": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/AnalyticConnection"
}
}
},
"x-qlik-visibility": "Public",
"x-qlik-stability": "Locked"
}
},
"/app/{id}/replace": {
"put": {
"operationId": "a26375e5-5fb5-41e6-9117-ae145181caf0",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"format": "uuid"
},
{
"name": "app",
"in": "query",
"required": true,
"type": "string",
"format": "uuid"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/App"
}
}
},
"x-qlik-visibility": "Public",
"x-qlik-stability": "Locked"
},
"post": {
"operationId": "3d02afa0-85d5-40bc-a25e-a39c416f46a1",
"parameters": [
{
"name": "appchanges",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/EngineAppChange"
}
},
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"format": "uuid"
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/EngineAppBundle"
}
}
},
"x-qlik-visibility": "Private",
"x-qlik-stability": "Experimental"
}
},
"/app/{id}/enginedatasegment": {
"get": {
"operationId": "8558e3fc-3a40-4910-b1ec-748f6aaa1322",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"format": "uuid"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/EngineAppBundle"
}
}
},
"x-qlik-visibility": "Private",
"x-qlik-stability": "Experimental"
}
},
"UserSyncTaskOperational": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"createdDate": {
"type": "string",
"format": "date-time"
},
"modifiedDate": {
"type": "string",
"format": "date-time"
},
"modifiedByUserName": {
"type": "string"
},
"schemaPath": {
"type": "string"
},
"privileges": {
"type": "array",
"items": {
"type": "string"
}
},
"lastExecutionResult": {
"$ref": "#/definitions/ExecutionResultCondensed"
},
"nextExecution": {
"type": "string",
"format": "date-time"
}
},
"x-qlik-stability": "Locked"
},
"UserSyncTaskOperationalCondensed": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"privileges": {
"type": "array",
"items": {
"type": "string"
}
},
"lastExecutionResult": {
"$ref": "#/definitions/ExecutionResultCondensed"
},
"nextExecution": {
"type": "string",
"format": "date-time"
}
},
"x-qlik-stability": "Locked"
},
"VirtualProxyConfig": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"createdDate": {
"type": "string",
"format": "date-time"
},
"modifiedDate": {
"type": "string",
"format": "date-time"
},
"modifiedByUserName": {
"type": "string"
},
"schemaPath": {
"type": "string"
},
"privileges": {
"type": "array",
"items": {
"type": "string"
}
},
"customProperties": {
"type": "array",
"items": {
"$ref": "#/definitions/CustomPropertyValue"
}
},
"prefix": {
"type": "string",
"maxLength": 100
},
"description": {
"type": "string",
"maxLength": 500
},
"authenticationModuleRedirectUri": {
"type": "string",
"format": "uri",
"maxLength": 1024
},
"sessionModuleBaseUri": {
"type": "string",
"format": "uri",
"maxLength": 1024
},
"loadBalancingModuleBaseUri": {
"type": "string",
"format": "uri",
"maxLength": 1024
},
"useStickyLoadBalancing": {
"type": "boolean"
},
"loadBalancingServerNodes": {
"type": "array",
"items": {
"$ref": "#/definitions/ServerNodeConfigurationCondensed"
}
},
"authenticationMethod": {
"type": "integer",
"default": 0,
"enum": [
0,
1,
2,
3,
4
],
"x-enumNames": [
"Ticket",
"HeaderStaticUserDirectory",
"HeaderDynamicUserDirectory",
"SAML",
"JWT"
]
},
"headerAuthenticationMode": {
"type": "integer",
"default": 0,
"enum": [
0,
1,
2,
3
],
"x-enumNames": [
"NotAllowed",
"StaticUserDirectory",
"DynamicUserDirectory",
"Undefined"
],
"x-qlik-deprecated": true
},
"headerAuthenticationHeaderName": {
"type": "string",
"format": "http-header-name",
"maxLength": 256
},
"headerAuthenticationStaticUserDirectory": {
"type": "string",
"maxLength": 256
},
"headerAuthenticationDynamicUserDirectory": {
"type": "string",
"maxLength": 256
},
"anonymousAccessMode": {
"type": "integer",
"default": 0,
"enum": [
0,
1,
2
],
"x-enumNames": [
"NoAnonymousUser",
"AllowAnonymous",
"AlwaysAnonymous"
]
},
"windowsAuthenticationEnabledDevicePattern": {
"type": "string",
"maxLength": 256,
"minLength": 1
},
"sessionCookieHeaderName": {
"type": "string",
"format": "http-header-name",
"maxLength": 256,
"minLength": 1
},
"sessionCookieDomain": {
"type": "string",
"maxLength": 256,
"minLength": 1
},
"additionalResponseHeaders": {
"type": "string",
"maxLength": 1024
},
"sessionInactivityTimeout": {
"type": "integer",
"format": "minutes",
"maximum": 71582,
"minimum": 1
},
"extendedSecurityEnvironment": {
"type": "boolean"
},
"websocketCrossOriginWhiteList": {
"type": "array",
"items": {
"type": "string"
}
},
"defaultVirtualProxy": {
"type": "boolean"
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/TagCondensed"
}
},
"samlMetadataIdP": {
"type": "string",
"maxLength": 100000
},
"samlHostUri": {
"type": "string",
"format": "uri",
"maxLength": 1024
},
"samlEntityId": {
"type": "string",
"maxLength": 255
},
"samlAttributeUserId": {
"type": "string",
"maxLength": 255
},
"samlAttributeUserDirectory": {
"type": "string",
"maxLength": 255
},
"samlAttributeSigningAlgorithm": {
"type": "integer",
"default": 0,
"enum": [
0,
1
],
"x-enumNames": [
"SHA1",
"SHA256"
]
},
"samlAttributeMap": {
"type": "array",
"items": {
"$ref": "#/definitions/VirtualProxyConfigSamlAttributeMapItem"
}
},
"jwtAttributeUserId": {
"type": "string",
"maxLength": 255
},
"jwtAttributeUserDirectory": {
"type": "string",
"maxLength": 255
},
"jwtPublicKeyCertificate": {
"type": "string",
"maxLength": 100000
},
"jwtAttributeMap": {
"type": "array",
"items": {
"$ref": "#/definitions/VirtualProxyConfigJwtAttributeMapItem"
}
},
"magicLinkHostUri": {
"type": "string",
"format": "uri",
"maxLength": 1024
},
"magicLinkFriendlyName": {
"type": "string",
"maxLength": 255
},
"samlSlo": {
"type": "boolean"
}
},
"required": [
"sessionCookieHeaderName",
"sessionInactivityTimeout",
"defaultVirtualProxy"
],
"x-qlik-stability": "Locked"
},
"VirtualProxyConfigCondensed": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"privileges": {
"type": "array",
"items": {
"type": "string"
}
},
"prefix": {
"type": "string",
"maxLength": 100
},
"description": {
"type": "string",
"maxLength": 500
},
"authenticationModuleRedirectUri": {
"type": "string",
"format": "uri",
"maxLength": 1024
},
"sessionModuleBaseUri": {
"type": "string",
"format": "uri",
"maxLength": 1024
},
"loadBalancingModuleBaseUri": {
"type": "string",
"format": "uri",
"maxLength": 1024
},
"useStickyLoadBalancing": {
"type": "boolean"
},
"loadBalancingServerNodes": {
"type": "array",
"items": {
"$ref": "#/definitions/ServerNodeConfigurationCondensed"
}
},
"authenticationMethod": {
"type": "integer",
"default": 0,
"enum": [
0,
1,
2,
3,
4
],
"x-enumNames": [
"Ticket",
"HeaderStaticUserDirectory",
"HeaderDynamicUserDirectory",
"SAML",
"JWT"
]
},
"headerAuthenticationMode": {
"type": "integer",
"default": 0,
"enum": [
0,
1,
2,
3
],
"x-enumNames": [
"NotAllowed",
"StaticUserDirectory",
"DynamicUserDirectory",
"Undefined"
],
"x-qlik-deprecated": true
},
"headerAuthenticationHeaderName": {
"type": "string",
"format": "http-header-name",
"maxLength": 256
},
"headerAuthenticationStaticUserDirectory": {
"type": "string",
"maxLength": 256
},
"headerAuthenticationDynamicUserDirectory": {
"type": "string",
"maxLength": 256
},
"anonymousAccessMode": {
"type": "integer",
"default": 0,
"enum": [
0,
1,
2
],
"x-enumNames": [
"NoAnonymousUser",
"AllowAnonymous",
"AlwaysAnonymous"
]
},
"windowsAuthenticationEnabledDevicePattern": {
"type": "string",
"maxLength": 256,
"minLength": 1
},
"sessionCookieHeaderName": {
"type": "string",
"format": "http-header-name",
"maxLength": 256,
"minLength": 1
},
"sessionCookieDomain": {
"type": "string",
"maxLength": 256,
"minLength": 1
},
"additionalResponseHeaders": {
"type": "string",
"maxLength": 1024
},
"sessionInactivityTimeout": {
"type": "integer",
"format": "minutes",
"maximum": 71582,
"minimum": 1
},
"extendedSecurityEnvironment": {
"type": "boolean"
},
"websocketCrossOriginWhiteList": {
"type": "array",
"items": {
"type": "string"
}
},
"defaultVirtualProxy": {
"type": "boolean"
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/TagCondensed"
}
},
"samlMetadataIdP": {
"type": "string",
"maxLength": 100000
},
"samlHostUri": {
"type": "string",
"format": "uri",
"maxLength": 1024
},
"samlEntityId": {
"type": "string",
"maxLength": 255
},
"samlAttributeUserId": {
"type": "string",
"maxLength": 255
},
"samlAttributeUserDirectory": {
"type": "string",
"maxLength": 255
},
"samlAttributeSigningAlgorithm": {
"type": "integer",
"default": 0,
"enum": [
0,
1
],
"x-enumNames": [
"SHA1",
"SHA256"
]
},
"samlAttributeMap": {
"type": "array",
"items": {
"$ref": "#/definitions/VirtualProxyConfigSamlAttributeMapItem"
}
},
"jwtAttributeUserId": {
"type": "string",
"maxLength": 255
},
"jwtAttributeUserDirectory": {
"type": "string",
"maxLength": 255
},
"jwtPublicKeyCertificate": {
"type": "string",
"maxLength": 100000
},
"jwtAttributeMap": {
"type": "array",
"items": {
"$ref": "#/definitions/VirtualProxyConfigJwtAttributeMapItem"
}
},
"magicLinkHostUri": {
"type": "string",
"format": "uri",
"maxLength": 1024
},
"magicLinkFriendlyName": {
"type": "string",
"maxLength": 255
},
"samlSlo": {
"type": "boolean"
}
},
"required": [
"sessionCookieHeaderName",
"sessionInactivityTimeout",
"defaultVirtualProxy"
],
"x-qlik-stability": "Locked"
},
"VirtualProxyConfigJwtAttributeMapItem": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"createdDate": {
"type": "string",
"format": "date-time"
},
"modifiedDate": {
"type": "string",
"format": "date-time"
},
"modifiedByUserName": {
"type": "string"
},
"schemaPath": {
"type": "string"
},
"jwtAttribute": {
"type": "string",
"maxLength": 255
},
"senseAttribute": {
"type": "string",
"maxLength": 255
},
"isMandatory": {
"type": "boolean"
}
},
"required": [
"jwtAttribute",
"senseAttribute",
"isMandatory"
]
},
"VirtualProxyConfigSamlAttributeMapItem": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"createdDate": {
"type": "string",
"format": "date-time"
},
"modifiedDate": {
"type": "string",
"format": "date-time"
},
"modifiedByUserName": {
"type": "string"
},
"schemaPath": {
"type": "string"
},
"samlAttribute": {
"type": "string",
"maxLength": 255
},
"senseAttribute": {
"type": "string",
"maxLength": 255
},
"isMandatory": {
"type": "boolean"
}
},
"required": [
"samlAttribute",
"senseAttribute",
"isMandatory"
]
}
}
}