Lab: Apply the Polymorphic Pattern

Hi,
The validator for m320 seems to be validating my assignment solution against a different schema. I solved the assignment as per the bullet points in the question. But on command prompt when I run the validator - as shown below -
validate_m320 pattern_polymorphic --file pattern_polymorphic.json --verbose=3

I get the following output -

Validating against the schema:
{
“$id”: “https://university.mongodb.com/m320/homework.polymorphic2.pattern.solution.json”,
“$schema”: “http://json-schema.org/draft-07/schema#”,
“title”: “Homework for the Polymorchic Pattern”,
“type”: “object”,
“required”: ["_id", “first_name”,“last_name”, “recruiting_source”, “extend_offer”, “team_placement”, “start_date”, “end_date”, “education”
, “skills”, “notes”],
“additionalProperties”: false,
“properties”: {
“_id”: {
“type”: “string”,
“enum”: [""]
},
“first_name”: {
“type”: “string”,
“enum”: [""]
},
“last_name”: {
“type”: “string”,
“enum”: [""]
},
“recruiting_source”: {
“type”: “string”,
“enum”: [""]
},
“extend_offer”: {
“type”: “string”,
“enum”: [""]
},
“team_placement”: {
“type”: “string”,
“enum”: [""]
},
“start_date”: {
“type”: “string”,
“enum”: [""]
},
“end_date”: {
“type”: “string”,
“enum”: [""]
},
“education”: {
“type”: “array”,
“items”: {
“description”: “details about the education”,
“type”: “object”,
“required”: [“level”, “subject”],
“additionalProperties”: false,
“properties”: {
“level”: {
“type”: “string”,
“enum”: [""]
},
“subject”: {
“type”: “string”,
“enum”: [""]
}
}
}
},
“skills”: {
“description”: “skills enumeration”,
“type”: “object”,
“required”: [“technical”, “languages”, “other”],
“additionalProperties”: false,
“properties”: {
“technical”: {
“type”: “array”,
“items”:{
“type”: “string”,
“enum”: [""]
}
},
“languages”: {
“type”: “array”,
“items”:{
“type”: “string”,
“enum”: [""]
}
},
“other”: {
“type”: “array”,
“items”:{
“type”: “string”,
“enum”: [""]
}
}
}
},
“notes”: {
“type”: “string”,
“enum”: [""]
}
}
}
The document fails validation against this solution

Detailed errors :

  • (root): first_name is required
    Detailed errors :
  • (root): last_name is required
    Detailed errors :
  • (root): recruiting_source is required
    Detailed errors :
  • (root): extend_offer is required
    Detailed errors :
  • (root): team_placement is required
    Detailed errors :
  • (root): start_date is required
    Detailed errors :
  • (root): end_date is required
    Detailed errors :
  • (root): education is required
    Detailed errors :
  • (root): skills is required
    Detailed errors :
  • (root): notes is required
    Detailed errors :
  • (root): Additional property authors is not allowed
    Detailed errors :
  • (root): Additional property format is not allowed
    Detailed errors :
  • (root): Additional property publisher is not allowed
    Detailed errors :
  • (root): Additional property title is not allowed
    Detailed errors :
  • (root): Additional property narrator is not allowed
    Detailed errors :
  • (root): Additional property product_id is not allowed
    Detailed errors :
  • (root): Additional property description is not allowed
    Detailed errors :
  • (root): Additional property language is not allowed
    Detailed errors :
  • (root): Additional property length_minutes is not allowed
    The document fails validation.

Errors:
At least one of your solutions is not passing validation.

Please help on this.

Thanks
Nusrat

Please check this link.It may help
They are talking about passing --verbose=2 as a fix

Chapter 4: Patterns (Part 2) Lab: Apply the Polymorphic Pattern validate error

1 Like

Hi
Thanks for the response.
I tried with verbose-2 and I still get validation error. See below -

C:\Mongodb_workspace>validate_m320 pattern_polymorphic --file pattern_polymorphic.json --verbose=2

Processing document: 1

… against solution: 1
Detailed errors :

  • (root): first_name is required
    Detailed errors :

  • (root): last_name is required
    Detailed errors :

  • (root): engineer_level is required
    Detailed errors :

  • (root): years_experience is required
    Detailed errors :

  • (root): previous_employer is required
    Detailed errors :

  • (root): recruiting_source is required
    Detailed errors :

  • (root): extend_offer is required
    Detailed errors :

  • (root): technical is required
    Detailed errors :

  • (root): education is required
    Detailed errors :

  • (root): non-technical is required
    Detailed errors :

  • (root): candidate_notes is required
    Detailed errors :

  • (root): Additional property title is not allowed
    Detailed errors :

  • (root): Additional property authors is not allowed
    Detailed errors :

  • (root): Additional property language is not allowed
    Detailed errors :

  • (root): Additional property pages is not allowed
    Detailed errors :

  • (root): Additional property publisher is not allowed
    Detailed errors :

  • (root): Additional property description is not allowed
    Detailed errors :
    Processing document: 1

    … against solution: 1
    Detailed errors :

  • (root): first_name is required
    Detailed errors :

  • (root): last_name is required
    Detailed errors :

  • (root): engineer_level is required
    Detailed errors :

  • (root): years_experience is required
    Detailed errors :

  • (root): previous_employer is required
    Detailed errors :

  • (root): recruiting_source is required
    Detailed errors :

  • (root): extend_offer is required
    Detailed errors :

  • (root): technical is required
    Detailed errors :

  • (root): education is required
    Detailed errors :

  • (root): non-technical is required
    Detailed errors :

  • (root): candidate_notes is required
    Detailed errors :

  • (root): Additional property publisher is not allowed
    Detailed errors :

  • (root): Additional property authors is not allowed
    Detailed errors :

  • (root): Additional property format is not allowed
    Detailed errors :

  • (root): Additional property length_minutes is not allowed
    Detailed errors :

  • (root): Additional property narrator is not allowed
    Detailed errors :

  • (root): Additional property product_id is not allowed
    Detailed errors :

  • (root): Additional property title is not allowed
    Detailed errors :

  • (root): Additional property description is not allowed
    Detailed errors :

  • (root): Additional property language is not allowed

    … against solution: 2
    Detailed errors :

  • (root): first_name is required
    Detailed errors :

  • (root): last_name is required
    Detailed errors :

  • (root): recruiting_source is required
    Detailed errors :

  • (root): extend_offer is required
    Detailed errors :

  • (root): team_placement is required
    Detailed errors :

  • (root): start_date is required
    Detailed errors :

  • (root): end_date is required
    Detailed errors :

  • (root): education is required
    Detailed errors :

  • (root): technical_skills is required
    Detailed errors :

  • (root): non-technical_skills is required
    Detailed errors :

  • (root): notes is required
    Detailed errors :

  • (root): Additional property authors is not allowed
    Detailed errors :

  • (root): Additional property description is not allowed
    Detailed errors :

  • (root): Additional property format is not allowed
    Detailed errors :

  • (root): Additional property language is not allowed
    Detailed errors :

  • (root): Additional property length_minutes is not allowed
    Detailed errors :

  • (root): Additional property publisher is not allowed
    Detailed errors :

  • (root): Additional property title is not allowed
    Detailed errors :

  • (root): Additional property narrator is not allowed
    Detailed errors :

  • (root): Additional property product_id is not allowed

    … against solution: 3
    Detailed errors :

  • (root): first_name is required
    Detailed errors :

  • (root): last_name is required
    Detailed errors :

  • (root): recruiting_source is required
    Detailed errors :

  • (root): extend_offer is required
    Detailed errors :

  • (root): team_placement is required
    Detailed errors :

  • (root): start_date is required
    Detailed errors :

  • (root): end_date is required
    Detailed errors :

  • (root): education is required
    Detailed errors :

  • (root): skills is required
    Detailed errors :

  • (root): notes is required
    Detailed errors :

  • (root): Additional property narrator is not allowed
    Detailed errors :

  • (root): Additional property product_id is not allowed
    Detailed errors :

  • (root): Additional property title is not allowed
    Detailed errors :

  • (root): Additional property authors is not allowed
    Detailed errors :

  • (root): Additional property description is not allowed
    Detailed errors :

  • (root): Additional property format is not allowed
    Detailed errors :

  • (root): Additional property language is not allowed
    Detailed errors :

  • (root): Additional property length_minutes is not allowed
    Detailed errors :

  • (root): Additional property publisher is not allowed
    The document fails validation.


    …same as above for Processing document: 2
    …same as above for Processing document: 3

Errors:
At least one of your solutions is not passing validation.

And when I validate with default verbose , it still gives error - see below

C:\Mongodb_workspace>validate_m320 pattern_polymorphic --file pattern_polymorphic.json --verbose
Answer Filename: C:/Mongodb_workspace/pattern_polymorphic.json

Processing document: 1

… against solution: 1

… against solution: 2

… against solution: 3
The document fails validation.

Processing document: 2

… against solution: 1

… against solution: 2

… against solution: 3
The document fails validation.

Processing document: 3

… against solution: 1

… against solution: 2

… against solution: 3
The document fails validation.

Errors:
At least one of your solutions is not passing validation.

C:\Mongodb_workspace>

Hi @NUSRAT_16306,

Sending you a direct message :slight_smile:

Kanika

Hi @kanikasingla

I have made corrections as per the review -

  1. authors should be unified - in third object i have defined it as array to make it consistent with first and second object
  2. Removed “pages” key - and added back the below -
    “eformats”: {
    “epub”: {
    “pages”: “”
    },
    “pdf”: {
    “pages”: “”
    }
    },

When i run the validatem320 i still get same errors as before.
Can you please validate the attached updated json and send me the validation code

Please refer the attached .txt file contains the updated json.
pattern_polymorphic_v2.txt (990 Bytes)

I am able to pass the validation using your v2 text file. Please check the command and file argument you are passing.

Kanika

Hi @kanikasingla

In my system, the following command was used to validate -
validate_m320 pattern_polymorphic --file pattern_polymorphic.json --verbose

However, this forum does not allow tp upload a .json file.

May I request you to do the following : -

  1. Save the .txt file as a json file named - pattern_polymorphic.json

  2. Open command prompt

  3. Validate the json with following command -
    validate_m320 pattern_polymorphic --file pattern_polymorphic.json --verbose

  4. Share the validation code

Thanks in advance
Nusrat

Hi @kanikasingla

I am still getting validations errors. ANd i think that is beause the validator is trying to compare schema fields with some other homework. I am struggling with this :slightly_frowning_face:
Please can you send me one-to-one the correct validator executable file (validate_mm320.exe). My data modelling modeule is stuck only because of this.
This is very frustrating :slightly_frowning_face: Thanks
Nusrat

Post a screenshot of the issue.

Hi @Ramchandra_37567

I tried verbose 2 and it still gives error.

Thanks
Nusrat

Hi @steevej-1495

See attached screenshot
I tried validating with verbose=2 but still error

Thanks
Nusrat

Its strange as I am using Windows and able to pass the lab using the same json file you shared with me earlier.

Can you make sure that file is located in the same folder where you are executing the validation command? and it is the same updated file you shared above as file you shared is “txt” file and file you are passing in the command is “json” file.

Kanika

Hi Kanika
The file is located in the same folder where i am executing the validation command. And I am passing the .json file as the argument - as shown below

C:\Mongodb_workspace>validate_m320 pattern_polymorphic --file pattern_polymorphic.json --verbose=2

note : i have been using same folder and same validator for all other assignments in the Data Modelling module and it worked perfectly fine.

Can you share the same json file here? :slight_smile:

Kanika

Hi @kanikasingla
This forum does not allow me to upload a .json file. Please advise.

Sending you a message where you can share the contents directly.

Kanika

Hi @kanikasingla
Any update on my validator problem ?
Thanks
Nusrat

I have sent a direct message. Please check and respond there.

Kanika

I had the same problem and fixed it by reinstalling the validator.

The failing version was:
validate_m320 version 02.00

The good version was:
validate_m320 version 02.01

validate_m320 pattern_polymorphic --file pattern_polymorphic.json --verbose
Answer Filename: N:/OneDrive/mongoDB/M320/pattern_polymorphic.json

Processing document: 1

… against solution: 1
The document passes validation

Processing document: 2

… against solution: 2
The document passes validation

Processing document: 3

… against solution: 3
The document passes validation

Congratulations - here is your validation code

1 Like

Hi @Neil_01783,

Can you please share the link to install latest version of validator.

Thanks
Nusrat