-
Notifications
You must be signed in to change notification settings - Fork 38
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
Use OpenAPI definitions as configuration schema #1022
base: main
Are you sure you want to change the base?
Conversation
src/components/ConfigEditor.vue
Outdated
@@ -76,26 +77,24 @@ | |||
}, | |||
methods: { | |||
componentFromField(field) { | |||
if (field.format === 'flags') return InputFlag; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good idea to test if it's enum
first, then if it's enum flags
. I can't guarantee that swagger won't decide to mark some other type with flags
format just because.
label, | ||
flag | ||
})) | ||
.filter(({ flag }) => flag % 2 === 0 || flag === 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I understand this code right but example value of 6
is not a standalone flag, it's 4 + 2
.
Standalone flag is a value which is equal to 2^n
, where n
is in range from 0
to 64
(but in reality we don't really have that many, up to 16 or so, so you can stick with max safe value from js).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, of course I didn't think too much coding this line, it was supposed to check whether the value is single flag (2^n
), gonna fix ;)
…g whether `log2(flag)` is an integer
Happy belated birthday to our first 1-year old PR 🥳 |
I'd like to mention ASFs OpenAPI extensions here. Since there is no official documentation of them on ASFs wiki, I'll just link the monologue of @JustArchi from the discord server for posterity: https://ptb.discord.com/channels/267292556709068800/332735075315744768/859854787634004049 |
Happy 2nd anniversary. Maybe one day. |
Description
As title says, the use of
GET /Type
andGET /Structure
was replaced by parsing OpenAPI documentation available in/swagger/ASF/swagger.json
. I focused on making existing components work with the mew definition and not much else, to reduce scope of the PR.Please test it with latest ASF release (V4.2.3.4), as it relies on introduced changes.
Additional information
Closes #871
The code style may be not consistent with the project, our eslint settings are very scuffed (eg. existing code doesn't follow latest rules from plugins) and fixing the code style is out of the scope for this PR.
TODO
Follow up
Checklist