Commit Graph

18 Commits

Author SHA1 Message Date
Kishan Shukla
a3ea74a914 Provide Input Validation for Romaing Mobility Domain
Signed-off-by: Kishan Shukla <kishan.shukla@hfcl.com>
2024-02-19 14:15:55 +01:00
Jo-Philipp Wich
b5531dd0a0 generate-reader, generate-example: introduce new uc-portrange format
The `uc-portrange` string format will match single ports and ranges
in `minport-maxport` notation.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-04-20 12:44:17 +02:00
Jo-Philipp Wich
3d02ca7b97 treewide: execute ucode in raw mode
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-04-20 12:44:17 +02:00
Jo-Philipp Wich
6e6a010ead schema: rename "fqdn" format to "uc-fqdn"
Non-standard formats shall be prefixed with "uc-" for clarity.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-04-20 12:44:17 +02:00
Jo-Philipp Wich
77b57b8179 generate-reader.uc: fix validation of hostname labels with two characters
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-01-17 09:35:02 +01:00
John Crispin
2d88a87753 add a more explicit error messag when reading the config
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-11 12:44:45 +01:00
Stijn Tintel
5e42737ad4 generate-reader.uc: rename ip to uc-ip
The JSON schema only defines ipv4 and ipv6 types, not ip. Prefix
non-standard type with uc-.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2021-11-02 17:38:16 +01:00
Stijn Tintel
b85abafcc0 generate-reader.uc: introduce ip format
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2021-10-13 16:26:52 +02:00
Jo-Philipp Wich
ddb447e9ed generate-reader, generate-example: introduce uc-base64 format
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-28 08:37:52 +02:00
Jo-Philipp Wich
1f64adaa8d generate-reader.uc: changes for better JSON schema spec compliance
- Ensure that type specific constraints are only applied if the processed
   value has the matching type

 - Support multiple types ("type": [ ... ])

 - Merge object values when processing subschema variants

 - Support sub schemas without any type

 - Improve formatting of enumerations in error messages

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-05-23 19:42:44 +02:00
Jo-Philipp Wich
bb7949b765 generate-reader.uc: fix validate() return value
Ensure that the validation document is returned even if the errors array
parameter is omitted when calling the validate() function.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-05-23 09:16:09 +02:00
Jo-Philipp Wich
1baa678f6e generate-reader.uc: another round of refactorings
- Drop internal "path" usage and turn it into an indent string
 - Rename emit_*_asserts() functions to emit_*_tests()
 - Enable strict mode
 - Remove require search path override

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-05-23 09:10:14 +02:00
Jo-Philipp Wich
5f7171baa3 generate-reader.uc: refactor reder generator
- Rewrite generator code to support tracking location and all schema
   errors in generated reader code

 - Improve validation error messages

 - Remove further dead code

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-05-22 21:03:09 +02:00
Jo-Philipp Wich
5406f01b11 generate-reader.uc: consolidate format validation code
Instead of redundantly pasting the validation inline multiple times, emit
global shared match functions and invoke those in the assert() expressions
instead.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-05-21 15:33:42 +02:00
Jo-Philipp Wich
73a9ee7834 generate-reader.uc: implement string format validation
- Generate code for validating formats
 - Remove dead code
 - Fix a wrong schema format discovered by the resulting reader code

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-05-21 14:49:58 +02:00
John Crispin
9af391dfa0 schema: s/-/_/g did not work for objects inside a one/anyOf block
Signed-off-by: John Crispin <john@phrozen.org>
2021-05-17 10:47:05 +02:00
Jo-Philipp Wich
9973f51894 generate-reader.uc: handle non-toplevel schema references
- Handle schema references in object schema types
 - Derive type from referenced sub schema if type property is missing
 - Avoid outputting trailing white space

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-05-15 17:31:31 +02:00
John Crispin
9585ababf7 schema: move over to the new schema/renderer
Signed-off-by: John Crispin <john@phrozen.org>
2021-05-14 10:39:10 +02:00