Update inline JSON schema documentation (#557)

## Changes
Add docs for experiments and models to the json schema. Update the
schema to the latest openapi spec.

## Tests
Manually
This commit is contained in:
shreyas-goenka 2023-07-07 15:00:12 +02:00 committed by GitHub
parent b6665f4b30
commit 057f328879
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 755 additions and 153 deletions

File diff suppressed because it is too large Load Diff

View File

@ -162,7 +162,7 @@ func (reader *OpenapiReader) jobsDocs() (*Docs, error) {
// TODO: add description for id if needed. // TODO: add description for id if needed.
// Tracked in https://github.com/databricks/cli/issues/242 // Tracked in https://github.com/databricks/cli/issues/242
jobsDocs := &Docs{ jobsDocs := &Docs{
Description: "List of job definations", Description: "List of Databricks jobs",
AdditionalProperties: jobDocs, AdditionalProperties: jobDocs,
} }
return jobsDocs, nil return jobsDocs, nil
@ -177,12 +177,38 @@ func (reader *OpenapiReader) pipelinesDocs() (*Docs, error) {
// TODO: Two fields in resources.Pipeline have the json tag id. Clarify the // TODO: Two fields in resources.Pipeline have the json tag id. Clarify the
// semantics and then add a description if needed. (https://github.com/databricks/cli/issues/242) // semantics and then add a description if needed. (https://github.com/databricks/cli/issues/242)
pipelinesDocs := &Docs{ pipelinesDocs := &Docs{
Description: "List of pipeline definations", Description: "List of DLT pipelines",
AdditionalProperties: pipelineDocs, AdditionalProperties: pipelineDocs,
} }
return pipelinesDocs, nil return pipelinesDocs, nil
} }
func (reader *OpenapiReader) experimentsDocs() (*Docs, error) {
experimentSpecSchema, err := reader.readResolvedSchema(SchemaPathPrefix + "ml.Experiment")
if err != nil {
return nil, err
}
experimentDocs := schemaToDocs(experimentSpecSchema)
experimentsDocs := &Docs{
Description: "List of MLflow experiments",
AdditionalProperties: experimentDocs,
}
return experimentsDocs, nil
}
func (reader *OpenapiReader) modelsDocs() (*Docs, error) {
modelSpecSchema, err := reader.readResolvedSchema(SchemaPathPrefix + "ml.Model")
if err != nil {
return nil, err
}
modelDocs := schemaToDocs(modelSpecSchema)
modelsDocs := &Docs{
Description: "List of MLflow models",
AdditionalProperties: modelDocs,
}
return modelsDocs, nil
}
func (reader *OpenapiReader) ResourcesDocs() (*Docs, error) { func (reader *OpenapiReader) ResourcesDocs() (*Docs, error) {
jobsDocs, err := reader.jobsDocs() jobsDocs, err := reader.jobsDocs()
if err != nil { if err != nil {
@ -192,12 +218,22 @@ func (reader *OpenapiReader) ResourcesDocs() (*Docs, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
experimentsDocs, err := reader.experimentsDocs()
if err != nil {
return nil, err
}
modelsDocs, err := reader.modelsDocs()
if err != nil {
return nil, err
}
return &Docs{ return &Docs{
Description: "Specification of databricks resources to instantiate", Description: "Collection of Databricks resources to deploy.",
Properties: map[string]*Docs{ Properties: map[string]*Docs{
"jobs": jobsDocs, "jobs": jobsDocs,
"pipelines": pipelinesDocs, "pipelines": pipelinesDocs,
"experiments": experimentsDocs,
"models": modelsDocs,
}, },
}, nil }, nil
} }