Skip to content

Commit

Permalink
fix: invalid jsonschema
Browse files Browse the repository at this point in the history
closes #4511

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Dec 31, 2023
1 parent 5296d35 commit 9ce21d3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/generate.yml
Expand Up @@ -24,12 +24,14 @@ jobs:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: "go install mvdan.cc/gofumpt@latest"
- run: "go install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest"
- run: task docs:releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: task docs:generate
- run: task schema:generate
- run: task nix:licenses:generate
- run: task schema:validate
- uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5
with:
commit_message: "chore: docs auto-update"
Expand Down
7 changes: 7 additions & 0 deletions Taskfile.yml
Expand Up @@ -80,6 +80,13 @@ tasks:
generates:
- ./www/docs/static/schema.json

schema:validate:
desc: Validate JSONSchema
cmds:
- jv ./www/docs/static/schema.json
sources:
- ./www/docs/static/schema.json

docs:generate:
desc: Generate docs
cmds:
Expand Down
12 changes: 6 additions & 6 deletions pkg/config/config.go
Expand Up @@ -285,8 +285,8 @@ func (a NixDependency) JSONSchema() *jsonschema.Schema {
reflector := jsonschema.Reflector{
ExpandedStruct: true,
}
type t NixDependency
schema := reflector.Reflect(&t{})
type nixDependencyAlias NixDependency
schema := reflector.Reflect(&nixDependencyAlias{})
return &jsonschema.Schema{
OneOf: []*jsonschema.Schema{
{
Expand Down Expand Up @@ -611,11 +611,11 @@ func (bh *Hook) UnmarshalYAML(unmarshal func(interface{}) error) error {
}

func (bh Hook) JSONSchema() *jsonschema.Schema {
type t Hook
type hookAlias Hook
reflector := jsonschema.Reflector{
ExpandedStruct: true,
}
schema := reflector.Reflect(&t{})
schema := reflector.Reflect(&hookAlias{})
return &jsonschema.Schema{
OneOf: []*jsonschema.Schema{
{
Expand Down Expand Up @@ -668,11 +668,11 @@ func (f *File) UnmarshalYAML(unmarshal func(interface{}) error) error {
}

func (f File) JSONSchema() *jsonschema.Schema {
type t File
type fileAlias File
reflector := jsonschema.Reflector{
ExpandedStruct: true,
}
schema := reflector.Reflect(&t{})
schema := reflector.Reflect(&fileAlias{})
return &jsonschema.Schema{
OneOf: []*jsonschema.Schema{
{
Expand Down
6 changes: 3 additions & 3 deletions www/docs/static/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9ce21d3

Please sign in to comment.