Is there a schema for the Github Actions yaml?
# github-workflows-kt
m
Is there a schema for the Github Actions yaml?
p
Yes, a community-maintained one is here https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json Plus in IntelliJ some built-in schema is used, but I haven't found its source yet. See also https://github.com/krzema12/github-actions-kotlin-dsl/issues/314 where I track an idea of using the schema to know what's missing in the library
m
Ah nice!
What about generating the DSL from the schema instead of using the schema for tests?
If you use the schema as a source of truth, you get 100% test coverage by construction?
Got curious. IntelliJ gets its own schema from https://schemastore.org/api/json/catalog.json
(this is made there)
So its using the same community-maintained one
p
Interesting idea with the generation, but I'm afraid there are too many edge cases where special treatment is needed. I'll give it a try, though :)
👍 2
a
I have been mulling over the thought of a library that generates Kotlin DSLs based on a Json Schema. Essentially it would generate some classes and functions that delegate to a json object. I don't think it would be very difficult, and it would be much more friendly than writing raw json/yaml. It would have all sorts of applications, like an OpenAPI spec DSL, or Spring Boot application props, or GitHub actions...
p
@Adam S feel free to give it a shot :) I don't have resources right now to make such big turnaround in the approach
a
Oh I I don't think a dsl generator would change anything about this project :) Except maybe in test code you could use it to more easily create test data. It would be like how Kotlinx Serialization has the
buildJsonObject {}
helper functions - but slightly more typed.
p
If it worked as I imagine, it would help ensure that we cover all attributes of GitHub's API think smart but yeah, the complexity would then go into the direction of making the generated DSL actually convenient to use