Skip to content

Commit

Permalink
Add mtlsRootUrl property to Discovery schema. (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
timburks authored Mar 17, 2020
1 parent 896953e commit dfc4011
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 104 deletions.
14 changes: 13 additions & 1 deletion discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func NewDocument(in interface{}, context *compiler.Context) (*Document, error) {
message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
errors = append(errors, compiler.NewError(context, message))
}
allowedKeys := []string{"auth", "basePath", "baseUrl", "batchPath", "canonicalName", "description", "discoveryVersion", "documentationLink", "etag", "features", "fullyEncodeReservedExpansion", "icons", "id", "kind", "labels", "methods", "name", "ownerDomain", "ownerName", "packagePath", "parameters", "protocol", "resources", "revision", "rootUrl", "schemas", "servicePath", "title", "version", "version_module"}
allowedKeys := []string{"auth", "basePath", "baseUrl", "batchPath", "canonicalName", "description", "discoveryVersion", "documentationLink", "etag", "features", "fullyEncodeReservedExpansion", "icons", "id", "kind", "labels", "methods", "mtlsRootUrl", "name", "ownerDomain", "ownerName", "packagePath", "parameters", "protocol", "resources", "revision", "rootUrl", "schemas", "servicePath", "title", "version", "version_module"}
var allowedPatterns []*regexp.Regexp
invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
if len(invalidKeys) > 0 {
Expand Down Expand Up @@ -394,6 +394,15 @@ func NewDocument(in interface{}, context *compiler.Context) (*Document, error) {
errors = append(errors, compiler.NewError(context, message))
}
}
// string mtls_root_url = 31;
v31 := compiler.MapValueForKey(m, "mtlsRootUrl")
if v31 != nil {
x.MtlsRootUrl, ok = v31.(string)
if !ok {
message := fmt.Sprintf("has unexpected value for mtlsRootUrl: %+v (%T)", v31, v31)
errors = append(errors, compiler.NewError(context, message))
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
Expand Down Expand Up @@ -2266,6 +2275,9 @@ func (m *Document) ToRawInfo() interface{} {
if m.PackagePath != "" {
info = append(info, yaml.MapItem{Key: "packagePath", Value: m.PackagePath})
}
if m.MtlsRootUrl != "" {
info = append(info, yaml.MapItem{Key: "mtlsRootUrl", Value: m.MtlsRootUrl})
}
return info
}

Expand Down
3 changes: 3 additions & 0 deletions discovery/discovery.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@
},
"packagePath": {
"type": "string"
},
"mtlsRootUrl": {
"type": "string"
}
},
"definitions": {
Expand Down
Loading

0 comments on commit dfc4011

Please sign in to comment.