ASF-ui icon indicating copy to clipboard operation
ASF-ui copied to clipboard

Use OpenAPI definitions as configuration schema

Open Aareksio opened this issue 4 years ago • 3 comments

Description

As title says, the use of GET /Type and GET /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

  • [ ] Default model for new bot - currently we use empty object as a model, which breaks the inputs and sets wrong defaults on fields which didn't break.
  • [ ] Extensive testing - last thing we want is to break existing configs, and this change has full potential to do so
  • [ ] Adjust UI settings to follow new schema definitions
  • [ ] Test if the update didn't break handling of sensitive properties (Bot Config)

Follow up

  • Cleanup input logic, normalize variable names
  • Abstract schema preparation - currently almost the same logic is repeated in at least 3 components
  • Cleanup unused code left from parsing old definitions

Checklist

  • [x] My pull request is not a duplicate
  • [x] I added a descriptive title to this pull request
  • [ ] My code follows the code style of this project
  • [x] I have performed a self-review of my own code

Aareksio avatar Jun 27 '20 15:06 Aareksio

Happy belated birthday to our first 1-year old PR 🥳

MrBurrBurr avatar Jun 29 '21 22:06 MrBurrBurr

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

Abrynos avatar Jul 22 '21 13:07 Abrynos

Happy 2nd anniversary. Maybe one day.

Aareksio avatar Jul 04 '22 13:07 Aareksio