Skip to content

Add array size validation to the openapi-generator C templates #40

@davidjwbbc

Description

@davidjwbbc

Description

Modify the mustache templates in open5gs-tools/openapi-generator-templates/c/ to add the following validation:

  1. Add validation to confirm that objects parsed from JSON that include arrays with minItems and/or maxItems set contain a valid number of items after parsing of the array is complete.
  2. Add validation when converting a modelled object to JSON to confirm that arrays contain at least minItems number of items if minItems is given for the array and no more than maxItems if maxItems is given for the array in the OpenAPI description. Conversion to JSON fails if an array does not contain a valid number of items.
  3. Add validation to confirm that objects parsed from JSON that include maps with minProperties and/or maxProperties set contain a valid number of items after parsing of the map is complete.
  4. Add validation when converting a modelled object to JSON to confirm that maps contain at least minProperties number of entries if minProperties is given and no more than maxProperties number of entries if maxProperties is given. Conversion to JSON fails if a map does not contain a valid number of entries.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions