Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

validation on objects and items (repeat) #150

Open
benoit-campeau opened this issue Apr 27, 2023 · 0 comments
Open

validation on objects and items (repeat) #150

benoit-campeau opened this issue Apr 27, 2023 · 0 comments

Comments

@benoit-campeau
Copy link

Hello, again thank you very much for providing validation.

We are seeing 2 issues right now. Probably because it is not implemented, but i dont know!

  1. when we define something like this :
    repeated Localization localizations = 3 [(protoc.gen.jsonschema.field_options).required = true,(validate.rules).repeated.min_items = 1];

we get this :
"localizations": { "items": { "$ref": "#/definitions/Localization" }, "type": "array", "description": "localized values for this title scope and type."

no minItems = 1

FYI Localization look like that message Localization { string language = 1 [(protoc.gen.jsonschema.field_options).required = true,(protoc.gen.jsonschema.field_options).min_length=2, (protoc.gen.jsonschema.field_options).pattern = "^(?!\\s*$).+"]; string value = 2 [(protoc.gen.jsonschema.field_options).required = true, (protoc.gen.jsonschema.field_options).pattern = "^(?!\\s*$).+"]; }

  1. we try to use validation on items as in the doc of protoc-gen-validate. Is it possible to do something like this:
    repeated string value = 2 [(protoc.gen.jsonschema.field_options).required = true, (validate.rules).repeated.min_items = 1, (validate.rules).repeated.items.string.min_len = 1]; or repeated.items.string.pattern = 'regex-something' ?

Regards

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant