Combine top level and type validation error messages

Registered by Sahdev Zala

The current validation checks for correct naming of TOSCA top level sections in the template and stops the parser execution flow if find any incorrect name. This makes sense, however, it would be ideal if validation combine all the wrong names in to a single message when raise an error. This will be very useful as it doesn’t require running parser multiple times to locate incorrect naming error individually. Having all names together a part of message will just require a single fix before running parser again.
Also, validation for the naming for node types are an important validation aspect. However the current validation provides an error for an individual wrong node type naming instead of showing that altogether. It would be idea to combine names into a single message.
The scope of what to validate and how to validate is very wide and can not be covered in once, and so this requirement is just an initial step towards making validation better and can a low hanging fruit blueprint implementation for a new contributor.

As an example, TOSCA template with following top level section,
node_temp:
   mysql_database:
     type: tosca.nodes.Database
out:
   url:
    description: Test url.
gives following error first,
translator.toscalib.common.exception.UnknownFieldError: Template contain(s) unknown field: "node_temp", refer to the definition to verify valid values.
And after user fix that and run parser again it gives following error,
translator.toscalib.common.exception.UnknownFieldError: Template contain(s) unknown field: "out", refer to the definition to verify valid values.

Similarly for the following template with node_templates,
node_templates:
  webserver:
    type: tosca.nodes.server
  server:
    type: tosca.nodes.comp
gives error as:
translator.toscalib.common.exception.InvalidTypeError: Type "tosca.nodes.server" is not a valid type.
Once you fix tosca.nodes.WebServer3 to tosca.nodes.WebServer it gives following error
translator.toscalib.common.exception.InvalidTypeError: Type "tosca.nodes.comp" is not a valid type.
Ideally, such validation error should be combined and then should be provided to user in a single message as much as possible.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Medium
Drafter:
Sahdev Zala
Direction:
Approved
Assignee:
Sahdev Zala
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Sahdev Zala
Completed by
Sahdev Zala

Related branches

Sprints

Whiteboard

(spzala) implemented separately in the tosca-parser project.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.