Skip to content

Commit

Permalink
Fix schema generation for inline elements
Browse files Browse the repository at this point in the history
Signed-off-by: David Gageot <[email protected]>
  • Loading branch information
dgageot committed Feb 21, 2019
1 parent a2bdf96 commit 742aa9f
Show file tree
Hide file tree
Showing 12 changed files with 440 additions and 117 deletions.
6 changes: 3 additions & 3 deletions docs/content/en/docs/references/yaml/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function* template(definitions, parentDefinition, ref, ident) {
for (var key in properties) {
allProperties.push([key, properties[key]]);
}
if (definitions[name].oneOf) {
for (var properties of definitions[name].oneOf) {
if (definitions[name].anyOf) {
for (var properties of definitions[name].anyOf) {
for (var key in properties.properties) {
allProperties.push([key, properties.properties[key]]);
}
Expand Down Expand Up @@ -70,7 +70,7 @@ function* template(definitions, parentDefinition, ref, ident) {
if (definition.$ref) {
// Check if the referenced description is a final one
const refName = definition.$ref.replace('#/definitions/', '');
if (!definitions[refName].properties && !definitions[refName].oneOf) {
if (!definitions[refName].properties && !definitions[refName].anyOf) {
value = '{}'
}

Expand Down
26 changes: 19 additions & 7 deletions docs/content/en/schemas/v1alpha1.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "object",
"oneOf": [
"anyOf": [
{
"$ref": "#/definitions/SkaffoldPipeline"
}
Expand All @@ -23,6 +23,7 @@
"$ref": "#/definitions/DeployConfig"
}
},
"additionalProperties": false,
"description": "top level config object that is parsed from a skaffold.yaml"
},
"BuildConfig": {
Expand All @@ -38,7 +39,8 @@
"default": "\"\""
}
},
"oneOf": [
"additionalProperties": false,
"anyOf": [
{
"properties": {
"local": {
Expand All @@ -65,6 +67,7 @@
"$ref": "#/definitions/GoogleCloudBuild"
}
},
"additionalProperties": false,
"description": "contains the specific implementation and parameters needed for the build step. Only one field should be populated."
},
"LocalBuild": {
Expand All @@ -73,6 +76,7 @@
"type": "boolean"
}
},
"additionalProperties": false,
"description": "contains the fields needed to do a build on the local docker daemon and optionally push to a repository."
},
"GoogleCloudBuild": {
Expand All @@ -81,7 +85,8 @@
"type": "string",
"default": "\"\""
}
}
},
"additionalProperties": false
},
"DeployConfig": {
"properties": {
Expand All @@ -90,7 +95,8 @@
"default": "\"\""
}
},
"oneOf": [
"additionalProperties": false,
"anyOf": [
{
"properties": {
"helm": {
Expand All @@ -117,6 +123,7 @@
"$ref": "#/definitions/KubectlDeploy"
}
},
"additionalProperties": false,
"description": "contains the specific implementation and parameters needed for the deploy step. Only one field should be populated."
},
"KubectlDeploy": {
Expand All @@ -128,6 +135,7 @@
"type": "array"
}
},
"additionalProperties": false,
"description": "contains the configuration needed for deploying with <code>kubectl apply</code>"
},
"Manifest": {
Expand All @@ -148,7 +156,8 @@
"type": "object",
"default": "{}"
}
}
},
"additionalProperties": false
},
"HelmDeploy": {
"properties": {
Expand All @@ -158,7 +167,8 @@
},
"type": "array"
}
}
},
"additionalProperties": false
},
"HelmRelease": {
"properties": {
Expand Down Expand Up @@ -190,7 +200,8 @@
"type": "string",
"default": "\"\""
}
}
},
"additionalProperties": false
},
"Artifact": {
"properties": {
Expand All @@ -214,6 +225,7 @@
"default": "{}"
}
},
"additionalProperties": false,
"description": "represents items that need should be built, along with the context in which they should be built."
}
}
Expand Down
52 changes: 40 additions & 12 deletions docs/content/en/schemas/v1alpha2.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "object",
"oneOf": [
"anyOf": [
{
"$ref": "#/definitions/SkaffoldPipeline"
}
Expand Down Expand Up @@ -28,7 +28,8 @@
},
"type": "array"
}
}
},
"additionalProperties": false
},
"BuildConfig": {
"properties": {
Expand All @@ -42,7 +43,8 @@
"$ref": "#/definitions/TagPolicy"
}
},
"oneOf": [
"additionalProperties": false,
"anyOf": [
{
"properties": {
"local": {
Expand Down Expand Up @@ -82,12 +84,15 @@
"$ref": "#/definitions/DateTimeTagger"
}
},
"additionalProperties": false,
"description": "contains all the configuration for the tagging step"
},
"ShaTagger": {
"additionalProperties": false,
"description": "contains the configuration for the SHA tagger."
},
"GitTagger": {
"additionalProperties": false,
"description": "contains the configuration for the git tagger."
},
"EnvTemplateTagger": {
Expand All @@ -97,6 +102,7 @@
"default": "\"\""
}
},
"additionalProperties": false,
"description": "contains the configuration for the envTemplate tagger."
},
"DateTimeTagger": {
Expand All @@ -110,6 +116,7 @@
"default": "\"\""
}
},
"additionalProperties": false,
"description": "contains the configuration for the DateTime tagger."
},
"BuildType": {
Expand All @@ -124,6 +131,7 @@
"$ref": "#/definitions/KanikoBuild"
}
},
"additionalProperties": false,
"description": "contains the specific implementation and parameters needed for the build step. Only one field should be populated."
},
"LocalBuild": {
Expand All @@ -140,6 +148,7 @@
"default": "false"
}
},
"additionalProperties": false,
"description": "contains the fields needed to do a build on the local docker daemon and optionally push to a repository."
},
"GoogleCloudBuild": {
Expand All @@ -165,6 +174,7 @@
"default": "\"\""
}
},
"additionalProperties": false,
"description": "contains the fields needed to do a remote build on Google Cloud Build."
},
"KanikoBuild": {
Expand All @@ -190,10 +200,12 @@
"default": "\"\""
}
},
"additionalProperties": false,
"description": "contains the fields needed to do a on-cluster build using the kaniko image"
},
"DeployConfig": {
"oneOf": [
"additionalProperties": false,
"anyOf": [
{
"properties": {
"helm": {
Expand Down Expand Up @@ -230,6 +242,7 @@
"$ref": "#/definitions/KustomizeDeploy"
}
},
"additionalProperties": false,
"description": "contains the specific implementation and parameters needed for the deploy step. Only one field should be populated."
},
"KubectlDeploy": {
Expand All @@ -254,6 +267,7 @@
"$ref": "#/definitions/KubectlFlags"
}
},
"additionalProperties": false,
"description": "contains the configuration needed for deploying with <code>kubectl apply</code>"
},
"KubectlFlags": {
Expand Down Expand Up @@ -283,6 +297,7 @@
"default": "[]"
}
},
"additionalProperties": false,
"description": "describes additional options flags that are passed on the command line to kubectl either on every command (Global), on creations (Apply) or deletions (Delete)."
},
"HelmDeploy": {
Expand All @@ -294,6 +309,7 @@
"type": "array"
}
},
"additionalProperties": false,
"description": "contains the configuration needed for deploying with helm"
},
"KustomizeDeploy": {
Expand All @@ -305,7 +321,8 @@
"flags": {
"$ref": "#/definitions/KubectlFlags"
}
}
},
"additionalProperties": false
},
"HelmRelease": {
"properties": {
Expand Down Expand Up @@ -372,7 +389,8 @@
"imageStrategy": {
"$ref": "#/definitions/HelmImageStrategy"
}
}
},
"additionalProperties": false
},
"HelmPackaged": {
"properties": {
Expand All @@ -387,10 +405,12 @@
"default": "\"\""
}
},
"additionalProperties": false,
"description": "represents parameters for packaging helm chart."
},
"HelmImageStrategy": {
"oneOf": [
"additionalProperties": false,
"anyOf": [
{
"properties": {
"fqn": {
Expand All @@ -415,7 +435,8 @@
"helm": {
"$ref": "#/definitions/HelmConventionConfig"
}
}
},
"additionalProperties": false
},
"HelmFQNConfig": {
"properties": {
Expand All @@ -424,9 +445,11 @@
"default": "\"\""
}
},
"additionalProperties": false,
"description": "represents image config to use the FullyQualifiedImageName as param to set"
},
"HelmConventionConfig": {
"additionalProperties": false,
"description": "represents image config in the syntax of image.repository and image.tag"
},
"Artifact": {
Expand All @@ -440,7 +463,8 @@
"default": "\"\""
}
},
"oneOf": [
"additionalProperties": false,
"anyOf": [
{
"properties": {
"docker": {
Expand Down Expand Up @@ -471,6 +495,7 @@
"$ref": "#/definitions/DeployConfig"
}
},
"additionalProperties": false,
"description": "additional configuration that overrides default configuration when it is activated."
},
"ArtifactType": {
Expand All @@ -481,7 +506,8 @@
"bazel": {
"$ref": "#/definitions/BazelArtifact"
}
}
},
"additionalProperties": false
},
"DockerArtifact": {
"properties": {
Expand All @@ -508,15 +534,17 @@
"type": "string",
"default": "\"\""
}
}
},
"additionalProperties": false
},
"BazelArtifact": {
"properties": {
"target": {
"type": "string",
"default": "\"\""
}
}
},
"additionalProperties": false
}
}
}
Loading

0 comments on commit 742aa9f

Please sign in to comment.