Page MenuHomeVyOS Platform

Generate schema definitions from standardized op-mode scripts
Closed, ResolvedPublicENHANCEMENT

Description

Current progress on T2719, notably, PR #1351: "prototype of an op mode command runner based on type hints and introspection", allow one to automate the creation of corresponding GraphQL schema definition files. The current generating script is linked below. Resolvers (handlers) for these definitions are already dynamically generated, although still requiring that the named resolvers be added by hand to a list; that step will be automated as well, resulting in one only having to run the script to allow server response to any GraphQL op-mode request.

https://github.com/jestabro/vyos-1x/blob/gql-op-mode-merge/src/services/api/graphql/utils/schema_from_op_mode.py

Details

Difficulty level
Unknown (require assessment)
Version
vyos-1.4
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Feature (new functionality)

Event Timeline

jestabro triaged this task as Normal priority.Jul 19 2022, 1:06 PM
jestabro created this task.
jestabro created this object in space S1 VyOS Public.
jestabro changed the subtype of this task from "Task" to "Enhancement".Jul 31 2022, 2:17 PM

PR https://github.com/vyos/vyos-1x/pull/1455

curl -k --raw 'https://localhost/graphql' \
  -H 'Content-Type: application/json' \
  -d '{"query":" {\n ShowVrf (data: {key: \"foo\"}) {\n  success\n  errors\n  data {\n    result\n  }\n}\n}\n"}'

Getting data:

{"data":{"ShowVrf":{"success":true,"errors":null,"data":{"result":[{"ifname":"foo","operstate":"UP","address":"26:f6:35:05:7e:0a","flags":["NOARP","MASTER","UP","LOWER_UP"]}]}}}}