https://github.com/szykol/yang-validator
Backend for yang-validator app. Validate yang files on the fly.
https://github.com/szykol/yang-validator
Last synced: 2 months ago
JSON representation
Backend for yang-validator app. Validate yang files on the fly.
- Host: GitHub
- URL: https://github.com/szykol/yang-validator
- Owner: szykol
- License: apache-2.0
- Created: 2024-11-28T21:17:37.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-11-28T21:23:26.000Z (6 months ago)
- Last Synced: 2025-02-04T19:17:57.636Z (4 months ago)
- Language: Go
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yang Validator
WIP
Simple backend for Yang Validator app.
The aim is to provide easy adhoc yang validation.## Credits
This project uses [openconfig/goyang](https://github.com/openconfig/goyang) for the yang validation.
## Usage
For MVP implementation the yang validation is done via HTTP server to get the project up & running without need of creating my own protocol.
This will be adjusted to the needs of frontend and probably changed in the future.The one and only endpoint is `/validate` that simply accepts bytes and returns `200 OK` if provided yang is valid. Otherwise `400 Bad Request` will be returned with validation error details sent as bytes.
> **NOTE**: User inputs are not yet sanitized or validated and are passed directly to the parsing lib.
```bash
# example of valid yang
curl localhost:1337/validate -d 'module small { namespace "http://example.com/small"; prefix small; }'
OK
# example of invalid yang
curl localhost:1337/validate -d 'module {'
Error: Invalid YANG: :2:0: missing 1 closing brace
```