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"
},









share|improve this question




















  • 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















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"
},









share|improve this question




















  • 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













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"
},









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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














  • 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












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Let this do the hard work for you



https://www.jsonschema.net






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    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

























    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






    share|improve this answer

























      up vote
      0
      down vote













      Let this do the hard work for you



      https://www.jsonschema.net






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Let this do the hard work for you



        https://www.jsonschema.net






        share|improve this answer












        Let this do the hard work for you



        https://www.jsonschema.net







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 9 at 0:19









        rikAtee

        4,59842855




        4,59842855






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Schultheiß

            Verwaltungsgliederung Dänemarks

            Liste der Kulturdenkmale in Wilsdruff