You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/10/17 03:41:50 UTC

[GitHub] [apisix] liuxiran commented on pull request #2440: WIP:plugin(consumer-restriction): use draft7 way to rewrite the JSON Schema.

liuxiran commented on pull request #2440:
URL: https://github.com/apache/apisix/pull/2440#issuecomment-710740234


   > According to the previous JSON schema data format, without changing the logic, the current writing method is not the same as the data obtained by apisix-dashboard. I need to discuss with @liuxiran again tomorrow
   
   @Jaycean 
   with the newest json schema
   ```json
   {
   	"oneOf": [{
   		"properties": {
   			"blacklist": {
   				"items": {
   					"type": "string"
   				},
   				"minItems": 1,
   				"type": "array"
   			},
   			"rejected_code": {
   				"default": 403,
   				"minimum": 200,
   				"type": "integer"
   			},
   			"type": {
   				"default": "consumer_name",
   				"enum": ["consumer_name", "service_id"],
   				"type": "string"
   			}
   		},
   		"required": ["blacklist"],
   		"title": "blacklist"
   	}, {
   		"properties": {
   			"rejected_code": {
   				"default": 403,
   				"minimum": 200,
   				"type": "integer"
   			},
   			"type": {
   				"default": "consumer_name",
   				"enum": ["consumer_name", "service_id"],
   				"type": "string"
   			},
   			"whitelist": {
   				"items": {
   					"type": "string"
   				},
   				"minItems": 1,
   				"type": "array"
   			}
   		},
   		"required": ["whitelist"],
   		"title": "whitelist"
   	}],
   	"properties": {
   		"disable": {
   			"type": "boolean"
   		}
   	},
   	"type": "object"
   }
   ```
   dashboard can create a route with `key-auth` plugin and `consumer-restriction` plugin successfully. and the `consumer-restriction` plugin can work correctly with the configuration.
   
   If you can change the keys **order** in properties one from current:
   `blacklist, rejected_code, type`  to expected `rejected_code, type, blacklist`, that would be better :)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org