Skip to content

Commit

Permalink
fix: clean schema-form to make them compatible with gio-form-json-sch…
Browse files Browse the repository at this point in the history
…ema component
  • Loading branch information
ThibaudAV committed Apr 11, 2023
1 parent 74e82b7 commit 3e1ae23
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 183 deletions.
116 changes: 55 additions & 61 deletions gravitee-policy-quota/src/main/resources/schemas/schema-form.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,60 @@
{
"type" : "object",
"id" : "urn:jsonschema:io:gravitee:policy:quota:configuration:QuotaPolicyConfiguration",
"properties" : {
"async": {
"type": "boolean",
"default": false,
"title": "Non-strict mode (async)",
"description": "By activating this option, quota is applied in an asynchronous way meaning that the distributed counter value is not strict."
},
"addHeaders": {
"type": "boolean",
"default": true,
"title": "Add response headers",
"description": "Add X-Quota-Limit, X-Quota-Remaining and X-Quota-Reset headers in HTTP response"
},
"quota" : {
"type" : "object",
"title": "Apply quota",
"id" : "urn:jsonschema:io:gravitee:policy:quota:configuration:QuotaConfiguration",
"properties" : {
"key": {
"type": "string",
"default": "",
"title": "Key",
"description": "Key to identify a consumer against whom the quota will be applied. Leave it empty to use the default behavior (plan/subscription pair). Supports EL.",
"x-schema-form": {
"expression-language": true
}
},
"limit" : {
"type" : "integer",
"title": "Max requests (static)",
"description": "Static limit on the number of requests that can be sent (this limit is used if the value > 0).",
"minimum": 0
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"async": {
"type": "boolean",
"default": false,
"title": "Non-strict mode (async)",
"description": "By activating this option, quota is applied in an asynchronous way meaning that the distributed counter value is not strict."
},
"dynamicLimit" : {
"type" : "string",
"title": "Max requests (dynamic)",
"description": "Dynamic limit on the number of requests that can be sent (this limit is used if static limit = 0). The dynamic value is based on EL expressions.",
"x-schema-form": {
"expression-language": true
}
"addHeaders": {
"type": "boolean",
"default": true,
"title": "Add response headers",
"description": "Add X-Quota-Limit, X-Quota-Remaining and X-Quota-Reset headers in HTTP response"
},
"periodTime" : {
"type" : "integer",
"title": "Time duration",
"default": 1
},
"periodTimeUnit" : {
"type" : "string",
"title": "Time unit",
"default": "MONTHS",
"enum" : [ "HOURS", "DAYS", "WEEKS", "MONTHS" ]
"quota": {
"type": "object",
"title": "Apply quota",
"properties": {
"key": {
"type": "string",
"default": "",
"title": "Key",
"description": "Key to identify a consumer against whom the quota will be applied. Leave it empty to use the default behavior (plan/subscription pair). Supports EL.",
"x-schema-form": {
"expression-language": true
}
},
"limit": {
"type": "integer",
"title": "Max requests (static)",
"description": "Static limit on the number of requests that can be sent (this limit is used if the value > 0).",
"minimum": 0
},
"dynamicLimit": {
"type": "string",
"title": "Max requests (dynamic)",
"description": "Dynamic limit on the number of requests that can be sent (this limit is used if static limit = 0). The dynamic value is based on EL expressions.",
"x-schema-form": {
"expression-language": true
}
},
"periodTime": {
"type": "integer",
"title": "Time duration",
"default": 1
},
"periodTimeUnit": {
"type": "string",
"title": "Time unit",
"default": "MONTHS",
"enum": ["HOURS", "DAYS", "WEEKS", "MONTHS"]
}
},
"required": ["periodTime", "periodTimeUnit"]
}
},
"required": [
"periodTime",
"periodTimeUnit"
]
}
},
"required": [
"quota"
]
},
"required": ["quota"]
}
116 changes: 55 additions & 61 deletions gravitee-policy-ratelimit/src/main/resources/schemas/schema-form.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,60 @@
{
"type" : "object",
"id" : "urn:jsonschema:io:gravitee:policy:ratelimit:configuration:RateLimitPolicyConfiguration",
"properties" : {
"async": {
"type": "boolean",
"default": false,
"title": "Non-strict mode (async)",
"description": "By activating this option, rate-limiting is applied in an asynchronous way meaning that the distributed counter value is not strict."
},
"addHeaders": {
"type": "boolean",
"default": false,
"title": "Add response headers",
"description": "Add X-Rate-Limit-Limit, X-Rate-Limit-Remaining and X-Rate-Limit-Reset headers in HTTP response"
},
"rate" : {
"type" : "object",
"title": "Apply rate-limiting",
"id" : "urn:jsonschema:io:gravitee:policy:ratelimit:configuration:RateLimitConfiguration",
"properties" : {
"key": {
"type": "string",
"default": "",
"title": "Key",
"description": "Key to identify a consumer against whom the rate-limiting will be applied. Leave it empty to use the default behavior (plan/subscription pair). Supports EL.",
"x-schema-form": {
"expression-language": true
}
},
"limit" : {
"type" : "integer",
"title": "Max requests (static)",
"description": "Static limit on the number of requests that can be sent (this limit is used if the value > 0).",
"minimum": 0
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"async": {
"type": "boolean",
"default": false,
"title": "Non-strict mode (async)",
"description": "By activating this option, rate-limiting is applied in an asynchronous way meaning that the distributed counter value is not strict."
},
"dynamicLimit" : {
"type" : "string",
"title": "Max requests (dynamic)",
"description": "Dynamic limit on the number of requests that can be sent (this limit is used if static limit = 0). The dynamic value is based on EL expressions.",
"x-schema-form": {
"expression-language": true
}
"addHeaders": {
"type": "boolean",
"default": false,
"title": "Add response headers",
"description": "Add X-Rate-Limit-Limit, X-Rate-Limit-Remaining and X-Rate-Limit-Reset headers in HTTP response"
},
"periodTime" : {
"type" : "integer",
"title": "Time duration",
"default": 1
},
"periodTimeUnit" : {
"type" : "string",
"title": "Time unit",
"default": "SECONDS",
"enum" : [ "SECONDS", "MINUTES" ]
"rate": {
"type": "object",
"title": "Apply rate-limiting",
"properties": {
"key": {
"type": "string",
"default": "",
"title": "Key",
"description": "Key to identify a consumer against whom the rate-limiting will be applied. Leave it empty to use the default behavior (plan/subscription pair). Supports EL.",
"x-schema-form": {
"expression-language": true
}
},
"limit": {
"type": "integer",
"title": "Max requests (static)",
"description": "Static limit on the number of requests that can be sent (this limit is used if the value > 0).",
"minimum": 0
},
"dynamicLimit": {
"type": "string",
"title": "Max requests (dynamic)",
"description": "Dynamic limit on the number of requests that can be sent (this limit is used if static limit = 0). The dynamic value is based on EL expressions.",
"x-schema-form": {
"expression-language": true
}
},
"periodTime": {
"type": "integer",
"title": "Time duration",
"default": 1
},
"periodTimeUnit": {
"type": "string",
"title": "Time unit",
"default": "SECONDS",
"enum": ["SECONDS", "MINUTES"]
}
},
"required": ["periodTime", "periodTimeUnit"]
}
},
"required": [
"periodTime",
"periodTimeUnit"
]
}
},
"required": [
"rate"
]
},
"required": ["rate"]
}
Original file line number Diff line number Diff line change
@@ -1,66 +1,60 @@
{
"type" : "object",
"id" : "urn:jsonschema:io:gravitee:policy:spike:configuration:SpikeArrestPolicyConfiguration",
"properties" : {
"async": {
"type": "boolean",
"default": false,
"title": "Non-strict mode (async)",
"description": "By activating this option, spike limit is applied in an asynchronous way meaning that the distributed counter value is not strict."
},
"addHeaders": {
"type": "boolean",
"default": false,
"title": "Add response headers",
"description": "Add X-Spike-Arrest-Limit, X-Spike-Arrest-Remaining and X-Spike-Arrest-Reset headers in HTTP response"
},
"spike" : {
"type" : "object",
"title": "Apply spike limit",
"id" : "urn:jsonschema:io:gravitee:policy:spike:configuration:SpikeArrestConfiguration",
"properties" : {
"key": {
"type": "string",
"default": "",
"title": "Key",
"description": "Key to identify a consumer against whom the quota will be applied. Leave it empty to use the default behavior. Supports EL.",
"x-schema-form": {
"expression-language": true
}
},
"limit" : {
"type" : "integer",
"title": "Max requests (static)",
"description": "Static limit on the number of requests that can be sent (this limit is used if the value > 0).",
"minimum": 0
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"async": {
"type": "boolean",
"default": false,
"title": "Non-strict mode (async)",
"description": "By activating this option, spike limit is applied in an asynchronous way meaning that the distributed counter value is not strict."
},
"dynamicLimit" : {
"type" : "string",
"title": "Max requests (dynamic)",
"description": "Dynamic limit on the number of requests that can be sent (this limit is used if static limit = 0). The dynamic value is based on EL expressions.",
"x-schema-form": {
"expression-language": true
}
"addHeaders": {
"type": "boolean",
"default": false,
"title": "Add response headers",
"description": "Add X-Spike-Arrest-Limit, X-Spike-Arrest-Remaining and X-Spike-Arrest-Reset headers in HTTP response"
},
"periodTime" : {
"type" : "integer",
"title": "Time duration",
"default": 1
},
"periodTimeUnit" : {
"type" : "string",
"title": "Time unit",
"default": "SECONDS",
"enum" : [ "SECONDS", "MINUTES" ]
"spike": {
"type": "object",
"title": "Apply spike limit",
"properties": {
"key": {
"type": "string",
"default": "",
"title": "Key",
"description": "Key to identify a consumer against whom the quota will be applied. Leave it empty to use the default behavior. Supports EL.",
"x-schema-form": {
"expression-language": true
}
},
"limit": {
"type": "integer",
"title": "Max requests (static)",
"description": "Static limit on the number of requests that can be sent (this limit is used if the value > 0).",
"minimum": 0
},
"dynamicLimit": {
"type": "string",
"title": "Max requests (dynamic)",
"description": "Dynamic limit on the number of requests that can be sent (this limit is used if static limit = 0). The dynamic value is based on EL expressions.",
"x-schema-form": {
"expression-language": true
}
},
"periodTime": {
"type": "integer",
"title": "Time duration",
"default": 1
},
"periodTimeUnit": {
"type": "string",
"title": "Time unit",
"default": "SECONDS",
"enum": ["SECONDS", "MINUTES"]
}
},
"required": ["periodTime", "periodTimeUnit"]
}
},
"required": [
"periodTime",
"periodTimeUnit"
]
}
},
"required": [
"spike"
]
},
"required": ["spike"]
}

0 comments on commit 3e1ae23

Please sign in to comment.