Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec writing: put common values like senders, room IDs, aliases, etc in a shared location #688

Open
turt2live opened this issue Sep 1, 2020 · 1 comment
Labels
A-Tools Related to the process and tools for building the spec

Comments

@turt2live
Copy link
Member

At the moment each example is responsible for trying to be consistent with all its $refs, which is a bit annoying. It'd be nice to be able to say %(roomId) or similar and have the spec generator automatically populate that field with a known value, allowing for consistency.

@turt2live turt2live added the A-Tools Related to the process and tools for building the spec label Sep 1, 2020
@KitsuneRal
Copy link
Member

For YAML parts, anchors look like a natural answer that works right now. Just tried it on banning.yaml: assuming

            example: {
                "reason": "Telling unfunny jokes",
                "user_id": &user_id1 "@cheeky_monkey:matrix.org"
              }

in /ban and

            example: {
                "user_id": *user_id1
              }

in /unban, the rendered spec has the resolved anchor in both places. Using a non-existent anchor leads to a very readable "yaml.composer.ComposerError: found undefined alias 'no_such_anchor'" error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Tools Related to the process and tools for building the spec
Projects
None yet
Development

No branches or pull requests

2 participants