Skip to content

Commit

Permalink
Move the schema template into pkg/schema
Browse files Browse the repository at this point in the history
All of our other file format schemas are in pkg/schema. This moves the
file to the right location and adds a copy instruction in our build
target to copy the template from the schema directory when we build.

Make the schema available at /schema/v1/NAME.schema.json

Signed-off-by: Carolyn Van Slyck <[email protected]>
  • Loading branch information
carolynvs committed Feb 28, 2022
1 parent 425d395 commit 0c74d27
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/static/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Redirect source code links
/:repo/src/* https://github.com/getporter/:repo/blob/main/:splat
/src/* https://github.com/getporter/porter/blob/main/:splat
/schema/v1/* https://raw.githubusercontent.com/getporter/porter/release/v1/pkg/schema/:splat

# Redirect
/twitter https://twitter.com/get_porter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://porter.sh/schema/v1/manifest.schema.json",
"title": "Porter manifest json schema",
"description": "Describes the format of the Porter manifest, porter.yaml. This does not include the schema of the mixins, use the porter schema command to generate a schema document that includes all installed mixins.",
"type": "object",
"definitions": {
"applyTo": {
Expand Down
5 changes: 2 additions & 3 deletions pkg/templates/templates.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package templates

import (
"fmt"

"embed"
"fmt"

"get.porter.sh/porter/pkg/config"
)
Expand Down Expand Up @@ -68,7 +67,7 @@ func (t *Templates) GetRunScript() ([]byte, error) {
}

// GetSchema returns the template manifest schema for the porter manifest.
// Note that is is incomplete and does not include the mixins' schemas.ß
// Note that it is incomplete and does not include the mixins' schemas.ß
func (t *Templates) GetSchema() ([]byte, error) {
return t.fs.ReadFile("templates/schema.json")
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/templates/templates/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# this file is copied from pkg/schema
schema.json

0 comments on commit 0c74d27

Please sign in to comment.