JSON SCHEMA PATTERN comma separated list
up vote
1
down vote
favorite
I have the following pattern in my json schema and i need to include comma separated values according to the following pattern. current pattern can handle only one pattern as DV2 only
so how should i modify my pattern to include multiple strings as follows, but it should match with the declared pattern.
ex: "DV2","DEV1","DEV3,"ST",
"ENVIRONMENT": {
"type": "string",
"pattern": ^(DV2|DEV|ST|DEV[1-5]{1}|DEV[1-9]{1,2}|ST[1-9]{1}|ST[1-9]{1,2})(,(DV2|DEV|ST|DEV[1-5]{1}|DEV[1-9]{1,2}|ST[1-9]{1}|ST[1-9]{1,2}))*$
},
This pattern works with regex checker, but not working with json schema.
{
"APPCODE": "MBUBU",
"ENVIRONMENT": "ST1","ST2","DEV1", //error, cant have multiple values separated by comma
"PROJECT_DETAILS": "ABCDEFGHIJ",
"ENV_OWNER": "ABCDEFGHIJKLMN"
},
python json regex
|
show 1 more comment
up vote
1
down vote
favorite
I have the following pattern in my json schema and i need to include comma separated values according to the following pattern. current pattern can handle only one pattern as DV2 only
so how should i modify my pattern to include multiple strings as follows, but it should match with the declared pattern.
ex: "DV2","DEV1","DEV3,"ST",
"ENVIRONMENT": {
"type": "string",
"pattern": ^(DV2|DEV|ST|DEV[1-5]{1}|DEV[1-9]{1,2}|ST[1-9]{1}|ST[1-9]{1,2})(,(DV2|DEV|ST|DEV[1-5]{1}|DEV[1-9]{1,2}|ST[1-9]{1}|ST[1-9]{1,2}))*$
},
This pattern works with regex checker, but not working with json schema.
{
"APPCODE": "MBUBU",
"ENVIRONMENT": "ST1","ST2","DEV1", //error, cant have multiple values separated by comma
"PROJECT_DETAILS": "ABCDEFGHIJ",
"ENV_OWNER": "ABCDEFGHIJKLMN"
},
python json regex
1
What is the question?
– V. Sambor
Nov 8 at 23:29
Looks like a usual^a(,a)*$
pattern."^(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2})(,(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2}))*$"
– Wiktor Stribiżew
Nov 8 at 23:32
@WiktorStribiżew Thanks for the info. but this should validate like this { "APPCODE": "MBUBUS", "ENVIRONMENT": "ST","ST2","DEV9" "PROJECT_DETAILS": "ABCDEFGHIJ", "ENV_OWNER": "ABCDEFGHIJKLMN" },, your regex gives some errors.
– Markus
Nov 8 at 23:49
Well, that is your regex, I only suggested the general solution for comma-separated values pattern. The details are unclear here.
– Wiktor Stribiżew
Nov 9 at 0:48
@WiktorStribiżew , updated the question. but your regex is working as expected in regex parser, not json schema.
– Markus
Nov 9 at 2:36
|
show 1 more comment
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have the following pattern in my json schema and i need to include comma separated values according to the following pattern. current pattern can handle only one pattern as DV2 only
so how should i modify my pattern to include multiple strings as follows, but it should match with the declared pattern.
ex: "DV2","DEV1","DEV3,"ST",
"ENVIRONMENT": {
"type": "string",
"pattern": ^(DV2|DEV|ST|DEV[1-5]{1}|DEV[1-9]{1,2}|ST[1-9]{1}|ST[1-9]{1,2})(,(DV2|DEV|ST|DEV[1-5]{1}|DEV[1-9]{1,2}|ST[1-9]{1}|ST[1-9]{1,2}))*$
},
This pattern works with regex checker, but not working with json schema.
{
"APPCODE": "MBUBU",
"ENVIRONMENT": "ST1","ST2","DEV1", //error, cant have multiple values separated by comma
"PROJECT_DETAILS": "ABCDEFGHIJ",
"ENV_OWNER": "ABCDEFGHIJKLMN"
},
python json regex
I have the following pattern in my json schema and i need to include comma separated values according to the following pattern. current pattern can handle only one pattern as DV2 only
so how should i modify my pattern to include multiple strings as follows, but it should match with the declared pattern.
ex: "DV2","DEV1","DEV3,"ST",
"ENVIRONMENT": {
"type": "string",
"pattern": ^(DV2|DEV|ST|DEV[1-5]{1}|DEV[1-9]{1,2}|ST[1-9]{1}|ST[1-9]{1,2})(,(DV2|DEV|ST|DEV[1-5]{1}|DEV[1-9]{1,2}|ST[1-9]{1}|ST[1-9]{1,2}))*$
},
This pattern works with regex checker, but not working with json schema.
{
"APPCODE": "MBUBU",
"ENVIRONMENT": "ST1","ST2","DEV1", //error, cant have multiple values separated by comma
"PROJECT_DETAILS": "ABCDEFGHIJ",
"ENV_OWNER": "ABCDEFGHIJKLMN"
},
python json regex
python json regex
edited Nov 9 at 2:22
asked Nov 8 at 23:27
Markus
306
306
1
What is the question?
– V. Sambor
Nov 8 at 23:29
Looks like a usual^a(,a)*$
pattern."^(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2})(,(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2}))*$"
– Wiktor Stribiżew
Nov 8 at 23:32
@WiktorStribiżew Thanks for the info. but this should validate like this { "APPCODE": "MBUBUS", "ENVIRONMENT": "ST","ST2","DEV9" "PROJECT_DETAILS": "ABCDEFGHIJ", "ENV_OWNER": "ABCDEFGHIJKLMN" },, your regex gives some errors.
– Markus
Nov 8 at 23:49
Well, that is your regex, I only suggested the general solution for comma-separated values pattern. The details are unclear here.
– Wiktor Stribiżew
Nov 9 at 0:48
@WiktorStribiżew , updated the question. but your regex is working as expected in regex parser, not json schema.
– Markus
Nov 9 at 2:36
|
show 1 more comment
1
What is the question?
– V. Sambor
Nov 8 at 23:29
Looks like a usual^a(,a)*$
pattern."^(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2})(,(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2}))*$"
– Wiktor Stribiżew
Nov 8 at 23:32
@WiktorStribiżew Thanks for the info. but this should validate like this { "APPCODE": "MBUBUS", "ENVIRONMENT": "ST","ST2","DEV9" "PROJECT_DETAILS": "ABCDEFGHIJ", "ENV_OWNER": "ABCDEFGHIJKLMN" },, your regex gives some errors.
– Markus
Nov 8 at 23:49
Well, that is your regex, I only suggested the general solution for comma-separated values pattern. The details are unclear here.
– Wiktor Stribiżew
Nov 9 at 0:48
@WiktorStribiżew , updated the question. but your regex is working as expected in regex parser, not json schema.
– Markus
Nov 9 at 2:36
1
1
What is the question?
– V. Sambor
Nov 8 at 23:29
What is the question?
– V. Sambor
Nov 8 at 23:29
Looks like a usual
^a(,a)*$
pattern. "^(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2})(,(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2}))*$"
– Wiktor Stribiżew
Nov 8 at 23:32
Looks like a usual
^a(,a)*$
pattern. "^(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2})(,(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2}))*$"
– Wiktor Stribiżew
Nov 8 at 23:32
@WiktorStribiżew Thanks for the info. but this should validate like this { "APPCODE": "MBUBUS", "ENVIRONMENT": "ST","ST2","DEV9" "PROJECT_DETAILS": "ABCDEFGHIJ", "ENV_OWNER": "ABCDEFGHIJKLMN" },, your regex gives some errors.
– Markus
Nov 8 at 23:49
@WiktorStribiżew Thanks for the info. but this should validate like this { "APPCODE": "MBUBUS", "ENVIRONMENT": "ST","ST2","DEV9" "PROJECT_DETAILS": "ABCDEFGHIJ", "ENV_OWNER": "ABCDEFGHIJKLMN" },, your regex gives some errors.
– Markus
Nov 8 at 23:49
Well, that is your regex, I only suggested the general solution for comma-separated values pattern. The details are unclear here.
– Wiktor Stribiżew
Nov 9 at 0:48
Well, that is your regex, I only suggested the general solution for comma-separated values pattern. The details are unclear here.
– Wiktor Stribiżew
Nov 9 at 0:48
@WiktorStribiżew , updated the question. but your regex is working as expected in regex parser, not json schema.
– Markus
Nov 9 at 2:36
@WiktorStribiżew , updated the question. but your regex is working as expected in regex parser, not json schema.
– Markus
Nov 9 at 2:36
|
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
0
down vote
Let this do the hard work for you
https://www.jsonschema.net
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Let this do the hard work for you
https://www.jsonschema.net
add a comment |
up vote
0
down vote
Let this do the hard work for you
https://www.jsonschema.net
add a comment |
up vote
0
down vote
up vote
0
down vote
Let this do the hard work for you
https://www.jsonschema.net
Let this do the hard work for you
https://www.jsonschema.net
answered Nov 9 at 0:19
rikAtee
4,59842855
4,59842855
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53217680%2fjson-schema-pattern-comma-separated-list%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What is the question?
– V. Sambor
Nov 8 at 23:29
Looks like a usual
^a(,a)*$
pattern."^(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2})(,(DV2|DEV|ST|DEV[1-5]|DEV[1-9]{1,2}|ST[1-9]|ST[1-9]{1,2}))*$"
– Wiktor Stribiżew
Nov 8 at 23:32
@WiktorStribiżew Thanks for the info. but this should validate like this { "APPCODE": "MBUBUS", "ENVIRONMENT": "ST","ST2","DEV9" "PROJECT_DETAILS": "ABCDEFGHIJ", "ENV_OWNER": "ABCDEFGHIJKLMN" },, your regex gives some errors.
– Markus
Nov 8 at 23:49
Well, that is your regex, I only suggested the general solution for comma-separated values pattern. The details are unclear here.
– Wiktor Stribiżew
Nov 9 at 0:48
@WiktorStribiżew , updated the question. but your regex is working as expected in regex parser, not json schema.
– Markus
Nov 9 at 2:36