schema: standardize JSON formatting

This commit is contained in:
Eric Chiang 2016-05-26 10:41:33 -07:00
parent f39191a92d
commit 2003df83cf
7 changed files with 288 additions and 293 deletions

View file

@ -34,7 +34,7 @@ __Version:__ v1
redirectURIs: [ redirectURIs: [
string string
], ],
secret: string secret: string // The client secret. Ignored in client create requests.
} }
``` ```

View file

@ -134,6 +134,7 @@ type Client struct {
// 2005. ) (Simple String Comparison). // 2005. ) (Simple String Comparison).
RedirectURIs []string `json:"redirectURIs,omitempty"` RedirectURIs []string `json:"redirectURIs,omitempty"`
// Secret: The client secret. Ignored in client create requests.
Secret string `json:"secret,omitempty"` Secret string `json:"secret,omitempty"`
} }

View file

@ -1,5 +1,4 @@
package adminschema package adminschema
// //
// This file is automatically generated by schema/generator // This file is automatically generated by schema/generator
// //
@ -28,70 +27,66 @@ const DiscoveryJSON = `{
"parameters": {}, "parameters": {},
"auth": {}, "auth": {},
"schemas": { "schemas": {
"Admin": { "Admin": {
"id": "Admin", "id": "Admin",
"type": "object", "type": "object",
"properties": { "properties": {
"id": { "id": {
"type": "string" "type": "string"
}, },
"email": { "email": {
"type": "string" "type": "string"
}, },
"password": { "password": {
"type": "string" "type": "string"
}
}
},
"State": {
"id": "State",
"type": "object",
"properties": {
"AdminUserCreated": {
"type": "boolean"
}
}
},
"Client": {
"id": "Client",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The client ID. Ignored in client create requests."
},
"secret": {
"type": "string",
"description": "The client secret. Ignored in client create requests."
},
"secret": {
"type": "string",
"format": "byte"
},
"isAdmin": {
"type": "boolean"
},
"redirectURIs": {
"type": "array",
"items": {
"type": "string"
},
"description": "REQUIRED. Array of Redirection URI values used by the Client. One of these registered Redirection URI values MUST exactly match the redirect_uri parameter value used in each Authorization Request, with the matching performed as described in Section 6.2.1 of [RFC3986] ( Berners-Lee, T., Fielding, R., and L. Masinter, “Uniform Resource Identifier (URI): Generic Syntax,” January 2005. ) (Simple String Comparison)."
},
"clientName": {
"type": "string",
"description": "OPTIONAL. Name of the Client to be presented to the End-User. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
},
"logoURI": {
"type": "string",
"description": "OPTIONAL. URL that references a logo for the Client application. If present, the server SHOULD display this image to the End-User during approval. The value of this field MUST point to a valid image file. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
},
"clientURI": {
"type": "string",
"description": "OPTIONAL. URL of the home page of the Client. The value of this field MUST point to a valid Web page. If present, the server SHOULD display this URL to the End-User in a followable fashion. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
}
} }
}, }
},
"State": {
"id": "State",
"type": "object",
"properties": {
"AdminUserCreated": {
"type": "boolean"
}
}
},
"Client": {
"id": "Client",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The client ID. Ignored in client create requests."
},
"secret": {
"type": "string",
"description": "The client secret. Ignored in client create requests."
},
"isAdmin": {
"type": "boolean"
},
"redirectURIs": {
"type": "array",
"items": {
"type": "string"
},
"description": "REQUIRED. Array of Redirection URI values used by the Client. One of these registered Redirection URI values MUST exactly match the redirect_uri parameter value used in each Authorization Request, with the matching performed as described in Section 6.2.1 of [RFC3986] ( Berners-Lee, T., Fielding, R., and L. Masinter, “Uniform Resource Identifier (URI): Generic Syntax,” January 2005. ) (Simple String Comparison)."
},
"clientName": {
"type": "string",
"description": "OPTIONAL. Name of the Client to be presented to the End-User. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
},
"logoURI": {
"type": "string",
"description": "OPTIONAL. URL that references a logo for the Client application. If present, the server SHOULD display this image to the End-User during approval. The value of this field MUST point to a valid image file. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
},
"clientURI": {
"type": "string",
"description": "OPTIONAL. URL of the home page of the Client. The value of this field MUST point to a valid Web page. If present, the server SHOULD display this URL to the End-User in a followable fashion. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
}
}
},
"ClientCreateRequest": { "ClientCreateRequest": {
"id": "ClientCreateRequest", "id": "ClientCreateRequest",
"type": "object", "type": "object",
@ -107,78 +102,77 @@ const DiscoveryJSON = `{
"type": "object", "type": "object",
"description": "Upon successful registration, an ID and secret is assigned to the client.", "description": "Upon successful registration, an ID and secret is assigned to the client.",
"properties": { "properties": {
"client":{ "client": {
"$ref": "Client" "$ref": "Client"
} }
} }
} }
}, },
"resources": { "resources": {
"Admin": { "Admin": {
"methods": { "methods": {
"Get": { "Get": {
"id": "dex.admin.Admin.Get", "id": "dex.admin.Admin.Get",
"description": "Retrieve information about an admin user.", "description": "Retrieve information about an admin user.",
"httpMethod": "GET", "httpMethod": "GET",
"path": "admin/{id}", "path": "admin/{id}",
"parameters": { "parameters": {
"id": { "id": {
"type": "string", "type": "string",
"required": true, "required": true,
"location": "path" "location": "path"
} }
}, },
"parameterOrder": [ "parameterOrder": [
"id" "id"
], ],
"response": { "response": {
"$ref": "Admin" "$ref": "Admin"
}
},
"Create": {
"id": "dex.admin.Admin.Create",
"description": "Create a new admin user.",
"httpMethod": "POST",
"path": "admin",
"request": {
"$ref": "Admin"
},
"response": {
"$ref": "Admin"
}
}
} }
}, },
"State": { "Create": {
"methods": { "id": "dex.admin.Admin.Create",
"Get": { "description": "Create a new admin user.",
"id": "dex.admin.State.Get", "httpMethod": "POST",
"description": "Get the state of the Dex DB", "path": "admin",
"httpMethod": "GET", "request": {
"path": "state", "$ref": "Admin"
"response": { },
"$ref": "State" "response": {
} "$ref": "Admin"
}
}
},
"Client": {
"methods": {
"Create": {
"id": "dex.admin.Client.Create",
"description": "Register an OpenID Connect client.",
"httpMethod": "POST",
"path": "client",
"request": {
"$ref": "ClientCreateRequest"
},
"response": {
"$ref": "ClientCreateResponse"
}
}
} }
}
} }
},
"State": {
"methods": {
"Get": {
"id": "dex.admin.State.Get",
"description": "Get the state of the Dex DB",
"httpMethod": "GET",
"path": "state",
"response": {
"$ref": "State"
}
}
}
},
"Client": {
"methods": {
"Create": {
"id": "dex.admin.Client.Create",
"description": "Register an OpenID Connect client.",
"httpMethod": "POST",
"path": "client",
"request": {
"$ref": "ClientCreateRequest"
},
"response": {
"$ref": "ClientCreateResponse"
}
}
}
}
} }
} }
` `

View file

@ -21,66 +21,66 @@
"parameters": {}, "parameters": {},
"auth": {}, "auth": {},
"schemas": { "schemas": {
"Admin": { "Admin": {
"id": "Admin", "id": "Admin",
"type": "object", "type": "object",
"properties": { "properties": {
"id": { "id": {
"type": "string" "type": "string"
}, },
"email": { "email": {
"type": "string" "type": "string"
}, },
"password": { "password": {
"type": "string" "type": "string"
}
}
},
"State": {
"id": "State",
"type": "object",
"properties": {
"AdminUserCreated": {
"type": "boolean"
}
}
},
"Client": {
"id": "Client",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The client ID. Ignored in client create requests."
},
"secret": {
"type": "string",
"description": "The client secret. Ignored in client create requests."
},
"isAdmin": {
"type": "boolean"
},
"redirectURIs": {
"type": "array",
"items": {
"type": "string"
},
"description": "REQUIRED. Array of Redirection URI values used by the Client. One of these registered Redirection URI values MUST exactly match the redirect_uri parameter value used in each Authorization Request, with the matching performed as described in Section 6.2.1 of [RFC3986] ( Berners-Lee, T., Fielding, R., and L. Masinter, “Uniform Resource Identifier (URI): Generic Syntax,” January 2005. ) (Simple String Comparison)."
},
"clientName": {
"type": "string",
"description": "OPTIONAL. Name of the Client to be presented to the End-User. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
},
"logoURI": {
"type": "string",
"description": "OPTIONAL. URL that references a logo for the Client application. If present, the server SHOULD display this image to the End-User during approval. The value of this field MUST point to a valid image file. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
},
"clientURI": {
"type": "string",
"description": "OPTIONAL. URL of the home page of the Client. The value of this field MUST point to a valid Web page. If present, the server SHOULD display this URL to the End-User in a followable fashion. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
}
} }
}, }
},
"State": {
"id": "State",
"type": "object",
"properties": {
"AdminUserCreated": {
"type": "boolean"
}
}
},
"Client": {
"id": "Client",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The client ID. Ignored in client create requests."
},
"secret": {
"type": "string",
"description": "The client secret. Ignored in client create requests."
},
"isAdmin": {
"type": "boolean"
},
"redirectURIs": {
"type": "array",
"items": {
"type": "string"
},
"description": "REQUIRED. Array of Redirection URI values used by the Client. One of these registered Redirection URI values MUST exactly match the redirect_uri parameter value used in each Authorization Request, with the matching performed as described in Section 6.2.1 of [RFC3986] ( Berners-Lee, T., Fielding, R., and L. Masinter, “Uniform Resource Identifier (URI): Generic Syntax,” January 2005. ) (Simple String Comparison)."
},
"clientName": {
"type": "string",
"description": "OPTIONAL. Name of the Client to be presented to the End-User. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
},
"logoURI": {
"type": "string",
"description": "OPTIONAL. URL that references a logo for the Client application. If present, the server SHOULD display this image to the End-User during approval. The value of this field MUST point to a valid image file. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
},
"clientURI": {
"type": "string",
"description": "OPTIONAL. URL of the home page of the Client. The value of this field MUST point to a valid Web page. If present, the server SHOULD display this URL to the End-User in a followable fashion. If desired, representation of this Claim in different languages and scripts is represented as described in Section 2.1 ( Metadata Languages and Scripts ) ."
}
}
},
"ClientCreateRequest": { "ClientCreateRequest": {
"id": "ClientCreateRequest", "id": "ClientCreateRequest",
"type": "object", "type": "object",
@ -96,77 +96,76 @@
"type": "object", "type": "object",
"description": "Upon successful registration, an ID and secret is assigned to the client.", "description": "Upon successful registration, an ID and secret is assigned to the client.",
"properties": { "properties": {
"client":{ "client": {
"$ref": "Client" "$ref": "Client"
} }
} }
} }
}, },
"resources": { "resources": {
"Admin": { "Admin": {
"methods": { "methods": {
"Get": { "Get": {
"id": "dex.admin.Admin.Get", "id": "dex.admin.Admin.Get",
"description": "Retrieve information about an admin user.", "description": "Retrieve information about an admin user.",
"httpMethod": "GET", "httpMethod": "GET",
"path": "admin/{id}", "path": "admin/{id}",
"parameters": { "parameters": {
"id": { "id": {
"type": "string", "type": "string",
"required": true, "required": true,
"location": "path" "location": "path"
} }
}, },
"parameterOrder": [ "parameterOrder": [
"id" "id"
], ],
"response": { "response": {
"$ref": "Admin" "$ref": "Admin"
}
},
"Create": {
"id": "dex.admin.Admin.Create",
"description": "Create a new admin user.",
"httpMethod": "POST",
"path": "admin",
"request": {
"$ref": "Admin"
},
"response": {
"$ref": "Admin"
}
}
} }
}, },
"State": { "Create": {
"methods": { "id": "dex.admin.Admin.Create",
"Get": { "description": "Create a new admin user.",
"id": "dex.admin.State.Get", "httpMethod": "POST",
"description": "Get the state of the Dex DB", "path": "admin",
"httpMethod": "GET", "request": {
"path": "state", "$ref": "Admin"
"response": { },
"$ref": "State" "response": {
} "$ref": "Admin"
}
}
},
"Client": {
"methods": {
"Create": {
"id": "dex.admin.Client.Create",
"description": "Register an OpenID Connect client.",
"httpMethod": "POST",
"path": "client",
"request": {
"$ref": "ClientCreateRequest"
},
"response": {
"$ref": "ClientCreateResponse"
}
}
} }
}
} }
},
"State": {
"methods": {
"Get": {
"id": "dex.admin.State.Get",
"description": "Get the state of the Dex DB",
"httpMethod": "GET",
"path": "state",
"response": {
"$ref": "State"
}
}
}
},
"Client": {
"methods": {
"Create": {
"id": "dex.admin.Client.Create",
"description": "Register an OpenID Connect client.",
"httpMethod": "POST",
"path": "client",
"request": {
"$ref": "ClientCreateRequest"
},
"response": {
"$ref": "ClientCreateResponse"
}
}
}
}
} }
} }

View file

@ -232,8 +232,8 @@ A client with associated public metadata.
> |Name|Located in|Description|Required|Type| > |Name|Located in|Description|Required|Type|
|:-----|:-----|:-----|:-----|:-----| |:-----|:-----|:-----|:-----|:-----|
| clientid | path | | Yes | string |
| userid | path | | Yes | string | | userid | path | | Yes | string |
| clientid | path | | Yes | string |
> __Responses__ > __Responses__
@ -310,8 +310,8 @@ A client with associated public metadata.
> |Name|Located in|Description|Required|Type| > |Name|Located in|Description|Required|Type|
|:-----|:-----|:-----|:-----|:-----| |:-----|:-----|:-----|:-----|:-----|
| nextPageToken | query | | No | string |
| maxResults | query | | No | integer | | maxResults | query | | No | integer |
| nextPageToken | query | | No | string |
> __Responses__ > __Responses__

View file

@ -1,5 +1,4 @@
package workerschema package workerschema
// //
// This file is automatically generated by schema/generator // This file is automatically generated by schema/generator
// //
@ -56,26 +55,26 @@ const DiscoveryJSON = `{
} }
} }
}, },
"RefreshClient": { "RefreshClient": {
"id": "Client", "id": "Client",
"type": "object", "type": "object",
"description": "A client with associated public metadata.", "description": "A client with associated public metadata.",
"properties": { "properties": {
"clientID": { "clientID": {
"type": "string" "type": "string"
}, },
"clientName": { "clientName": {
"type": "string" "type": "string"
}, },
"logoURI": { "logoURI": {
"type": "string" "type": "string"
}, },
"clientURI": { "clientURI": {
"type": "string" "type": "string"
} }
} }
}, },
"RefreshClientList": { "RefreshClientList": {
"id": "RefreshClientList", "id": "RefreshClientList",
"type": "object", "type": "object",
"properties": { "properties": {
@ -86,7 +85,7 @@ const DiscoveryJSON = `{
} }
} }
} }
}, },
"ClientWithSecret": { "ClientWithSecret": {
"id": "Client", "id": "Client",
"type": "object", "type": "object",
@ -154,7 +153,7 @@ const DiscoveryJSON = `{
"type": "object", "type": "object",
"properties": { "properties": {
"user": { "user": {
"$ref": "User" "$ref": "User"
} }
} }
}, },
@ -280,7 +279,8 @@ const DiscoveryJSON = `{
"httpMethod": "DELETE", "httpMethod": "DELETE",
"path": "account/{userid}/refresh/{clientid}", "path": "account/{userid}/refresh/{clientid}",
"parameterOrder": [ "parameterOrder": [
"userid","clientid" "userid",
"clientid"
], ],
"parameters": { "parameters": {
"clientid": { "clientid": {

View file

@ -49,26 +49,26 @@
} }
} }
}, },
"RefreshClient": { "RefreshClient": {
"id": "Client", "id": "Client",
"type": "object", "type": "object",
"description": "A client with associated public metadata.", "description": "A client with associated public metadata.",
"properties": { "properties": {
"clientID": { "clientID": {
"type": "string" "type": "string"
}, },
"clientName": { "clientName": {
"type": "string" "type": "string"
}, },
"logoURI": { "logoURI": {
"type": "string" "type": "string"
}, },
"clientURI": { "clientURI": {
"type": "string" "type": "string"
} }
} }
}, },
"RefreshClientList": { "RefreshClientList": {
"id": "RefreshClientList", "id": "RefreshClientList",
"type": "object", "type": "object",
"properties": { "properties": {
@ -79,7 +79,7 @@
} }
} }
} }
}, },
"ClientWithSecret": { "ClientWithSecret": {
"id": "Client", "id": "Client",
"type": "object", "type": "object",
@ -147,7 +147,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"user": { "user": {
"$ref": "User" "$ref": "User"
} }
} }
}, },
@ -273,7 +273,8 @@
"httpMethod": "DELETE", "httpMethod": "DELETE",
"path": "account/{userid}/refresh/{clientid}", "path": "account/{userid}/refresh/{clientid}",
"parameterOrder": [ "parameterOrder": [
"userid","clientid" "userid",
"clientid"
], ],
"parameters": { "parameters": {
"clientid": { "clientid": {