Convert old style jsonschema required params to new style.

This commit is contained in:
jakedt 2014-03-17 12:25:41 -04:00
parent 5bb4008880
commit ddf5f2053c
11 changed files with 79 additions and 59 deletions

View file

@ -99,12 +99,13 @@ class UserCard(ApiResource):
'id': 'UserCard', 'id': 'UserCard',
'type': 'object', 'type': 'object',
'description': 'Description of a user card', 'description': 'Description of a user card',
'required': True, 'required': [
'token',
],
'properties': { 'properties': {
'token': { 'token': {
'type': 'string', 'type': 'string',
'description': 'Stripe token that is generated by stripe checkout.js', 'description': 'Stripe token that is generated by stripe checkout.js',
'required': True,
}, },
}, },
}, },
@ -137,12 +138,13 @@ class OrganizationCard(ApiResource):
'id': 'OrgCard', 'id': 'OrgCard',
'type': 'object', 'type': 'object',
'description': 'Description of a user card', 'description': 'Description of a user card',
'required': True, 'required': [
'token',
],
'properties': { 'properties': {
'token': { 'token': {
'type': 'string', 'type': 'string',
'description': 'Stripe token that is generated by stripe checkout.js', 'description': 'Stripe token that is generated by stripe checkout.js',
'required': True,
}, },
}, },
}, },
@ -182,7 +184,9 @@ class UserPlan(ApiResource):
'id': 'UserSubscription', 'id': 'UserSubscription',
'type': 'object', 'type': 'object',
'description': 'Description of a user card', 'description': 'Description of a user card',
'required': True, 'required': [
'plan',
],
'properties': { 'properties': {
'token': { 'token': {
'type': 'string', 'type': 'string',
@ -191,7 +195,6 @@ class UserPlan(ApiResource):
'plan': { 'plan': {
'type': 'string', 'type': 'string',
'description': 'Plan name to which the user wants to subscribe', 'description': 'Plan name to which the user wants to subscribe',
'required': True,
}, },
}, },
}, },
@ -235,7 +238,9 @@ class OrganizationPlan(ApiResource):
'id': 'OrgSubscription', 'id': 'OrgSubscription',
'type': 'object', 'type': 'object',
'description': 'Description of a user card', 'description': 'Description of a user card',
'required': True, 'required': [
'plan',
],
'properties': { 'properties': {
'token': { 'token': {
'type': 'string', 'type': 'string',
@ -244,7 +249,6 @@ class OrganizationPlan(ApiResource):
'plan': { 'plan': {
'type': 'string', 'type': 'string',
'description': 'Plan name to which the user wants to subscribe', 'description': 'Plan name to which the user wants to subscribe',
'required': True,
}, },
}, },
}, },

View file

@ -47,12 +47,13 @@ class RepositoryBuildList(RepositoryParamResource):
'id': 'RepositoryBuildRequest', 'id': 'RepositoryBuildRequest',
'type': 'object', 'type': 'object',
'description': 'Description of a new repository build.', 'description': 'Description of a new repository build.',
'required': True, 'required': [
'file_id',
],
'properties': { 'properties': {
'file_id': { 'file_id': {
'type': 'string', 'type': 'string',
'description': 'The file id that was generated when the build spec was uploaded', 'description': 'The file id that was generated when the build spec was uploaded',
'required': True,
}, },
'subdirectory': { 'subdirectory': {
'type': 'string', 'type': 'string',
@ -160,12 +161,13 @@ class FileDropResource(ApiResource):
'id': 'FileDropRequest', 'id': 'FileDropRequest',
'type': 'object', 'type': 'object',
'description': 'Description of the file that the user wishes to upload.', 'description': 'Description of the file that the user wishes to upload.',
'required': True, 'required': [
'mimeType',
],
'properties': { 'properties': {
'mimeType': { 'mimeType': {
'type': 'string', 'type': 'string',
'description': 'Type of the file which is about to be uploaded', 'description': 'Type of the file which is about to be uploaded',
'required': True,
}, },
}, },
}, },

View file

@ -46,17 +46,18 @@ class OrganizationList(ApiResource):
'id': 'NewOrg', 'id': 'NewOrg',
'type': 'object', 'type': 'object',
'description': 'Description of a new organization.', 'description': 'Description of a new organization.',
'required': True, 'required': [
'name',
'email',
],
'properties': { 'properties': {
'name': { 'name': {
'type': 'string', 'type': 'string',
'description': 'Organization username', 'description': 'Organization username',
'required': True,
}, },
'email': { 'email': {
'type': 'string', 'type': 'string',
'description': 'Organization contact email', 'description': 'Organization contact email',
'required': True,
}, },
}, },
}, },
@ -100,7 +101,6 @@ class Organization(ApiResource):
'id': 'UpdateOrg', 'id': 'UpdateOrg',
'type': 'object', 'type': 'object',
'description': 'Description of updates for an existing organization', 'description': 'Description of updates for an existing organization',
'required': True,
'properties': { 'properties': {
'email': { 'email': {
'type': 'string', 'type': 'string',

View file

@ -87,7 +87,9 @@ class RepositoryUserPermission(RepositoryParamResource):
'id': 'UserPermission', 'id': 'UserPermission',
'type': 'object', 'type': 'object',
'description': 'Description of a user permission.', 'description': 'Description of a user permission.',
'required': True, 'required': [
'role',
],
'properties': { 'properties': {
'role': { 'role': {
'type': 'string', 'type': 'string',
@ -97,7 +99,6 @@ class RepositoryUserPermission(RepositoryParamResource):
'write', 'write',
'admin', 'admin',
], ],
'required': True,
}, },
}, },
}, },
@ -177,7 +178,9 @@ class RepositoryTeamPermission(RepositoryParamResource):
'id': 'TeamPermission', 'id': 'TeamPermission',
'type': 'object', 'type': 'object',
'description': 'Description of a team permission.', 'description': 'Description of a team permission.',
'required': True, 'required': [
'role',
],
'properties': { 'properties': {
'role': { 'role': {
'type': 'string', 'type': 'string',
@ -187,7 +190,6 @@ class RepositoryTeamPermission(RepositoryParamResource):
'write', 'write',
'admin', 'admin',
], ],
'required': True,
}, },
}, },
}, },

View file

@ -62,12 +62,14 @@ class PermissionPrototypeList(ApiResource):
'id': 'NewPrototype', 'id': 'NewPrototype',
'type': 'object', 'type': 'object',
'description': 'Description of a new prototype', 'description': 'Description of a new prototype',
'required': True, 'required': [
'role',
'delegate',
],
'properties': { 'properties': {
'role': { 'role': {
'type': 'string', 'type': 'string',
'description': 'Role that should be applied to the delegate', 'description': 'Role that should be applied to the delegate',
'required': True,
'enum': [ 'enum': [
'read', 'read',
'write', 'write',
@ -77,28 +79,31 @@ class PermissionPrototypeList(ApiResource):
'activating_user': { 'activating_user': {
'type': 'object', 'type': 'object',
'description': 'Repository creating user to whom the rule should apply', 'description': 'Repository creating user to whom the rule should apply',
'required': [
'name',
],
'properties': { 'properties': {
'name': { 'name': {
'type': 'string', 'type': 'string',
'description': 'The username for the activating_user', 'description': 'The username for the activating_user',
'required': True,
}, },
}, },
}, },
'delegate': { 'delegate': {
'type': 'object', 'type': 'object',
'description': 'Information about the user or team to which the rule grants access', 'description': 'Information about the user or team to which the rule grants access',
'required': True, 'required': [
'name',
'kind',
],
'properties': { 'properties': {
'name': { 'name': {
'type': 'string', 'type': 'string',
'description': 'The name for the delegate team or user', 'description': 'The name for the delegate team or user',
'required': True,
}, },
'kind': { 'kind': {
'type': 'string', 'type': 'string',
'description': 'Whether the delegate is a user or a team', 'description': 'Whether the delegate is a user or a team',
'required': True,
'enum': [ 'enum': [
'user', 'user',
'team', 'team',
@ -183,12 +188,13 @@ class PermissionPrototype(ApiResource):
'id': 'PrototypeUpdate', 'id': 'PrototypeUpdate',
'type': 'object', 'type': 'object',
'description': 'Description of a the new prototype role', 'description': 'Description of a the new prototype role',
'required': True, 'required': [
'role',
],
'properties': { 'properties': {
'role': { 'role': {
'type': 'string', 'type': 'string',
'description': 'Role that should be applied to the permission', 'description': 'Role that should be applied to the permission',
'required': True,
'enum': [ 'enum': [
'read', 'read',
'write', 'write',

View file

@ -27,12 +27,14 @@ class RepositoryList(ApiResource):
'id': 'NewRepo', 'id': 'NewRepo',
'type': 'object', 'type': 'object',
'description': 'Description of a new repository', 'description': 'Description of a new repository',
'required': True, 'required': [
'repository',
'visibility',
],
'properties': { 'properties': {
'repository': { 'repository': {
'type': 'string', 'type': 'string',
'description': 'Repository name', 'description': 'Repository name',
'required': True,
}, },
'visibility': { 'visibility': {
'type': 'string', 'type': 'string',
@ -41,7 +43,6 @@ class RepositoryList(ApiResource):
'public', 'public',
'private', 'private',
], ],
'required': True,
}, },
'namespace': { 'namespace': {
'type': 'string', 'type': 'string',
@ -155,12 +156,13 @@ class Repository(RepositoryParamResource):
'id': 'RepoUpdate', 'id': 'RepoUpdate',
'type': 'object', 'type': 'object',
'description': 'Fields which can be updated in a repository.', 'description': 'Fields which can be updated in a repository.',
'required': True, 'required': [
'description',
],
'properties': { 'properties': {
'description': { 'description': {
'type': 'string', 'type': 'string',
'description': 'Markdown encoded description for the repository', 'description': 'Markdown encoded description for the repository',
'required': True,
}, },
} }
} }
@ -250,7 +252,9 @@ class RepositoryVisibility(RepositoryParamResource):
'id': 'ChangeVisibility', 'id': 'ChangeVisibility',
'type': 'object', 'type': 'object',
'description': 'Change the visibility for the repository.', 'description': 'Change the visibility for the repository.',
'required': True, 'required': [
'visibility',
],
'properties': { 'properties': {
'visibility': { 'visibility': {
'type': 'string', 'type': 'string',
@ -259,7 +263,6 @@ class RepositoryVisibility(RepositoryParamResource):
'public', 'public',
'private', 'private',
], ],
'required': True,
}, },
} }
} }

View file

@ -27,12 +27,13 @@ class RepositoryTokenList(RepositoryParamResource):
'id': 'NewToken', 'id': 'NewToken',
'type': 'object', 'type': 'object',
'description': 'Description of a new token.', 'description': 'Description of a new token.',
'required': True, 'required':[
'friendlyName',
],
'properties': { 'properties': {
'friendlyName': { 'friendlyName': {
'type': 'string', 'type': 'string',
'description': 'Friendly name to help identify the token', 'description': 'Friendly name to help identify the token',
'required': True,
}, },
}, },
}, },
@ -73,7 +74,9 @@ class RepositoryToken(RepositoryParamResource):
'id': 'TokenPermission', 'id': 'TokenPermission',
'type': 'object', 'type': 'object',
'description': 'Description of a token permission', 'description': 'Description of a token permission',
'required': True, 'required': [
'role',
],
'properties': { 'properties': {
'role': { 'role': {
'type': 'string', 'type': 'string',
@ -83,7 +86,6 @@ class RepositoryToken(RepositoryParamResource):
'write', 'write',
'admin', 'admin',
], ],
'required': True,
}, },
}, },
}, },

View file

@ -35,12 +35,14 @@ class OrganizationTeam(ApiResource):
'id': 'TeamDescription', 'id': 'TeamDescription',
'type': 'object', 'type': 'object',
'description': 'Description of a team', 'description': 'Description of a team',
'required': True, 'required': [
'role',
'description',
],
'properties': { 'properties': {
'role': { 'role': {
'type': 'string', 'type': 'string',
'description': 'Org wide permissions that should apply to the team', 'description': 'Org wide permissions that should apply to the team',
'required': True,
'enum': [ 'enum': [
'member', 'member',
'creator', 'creator',
@ -50,7 +52,6 @@ class OrganizationTeam(ApiResource):
'description': { 'description': {
'type': 'string', 'type': 'string',
'description': 'Markdown description for the team', 'description': 'Markdown description for the team',
'required': True,
}, },
}, },
}, },

View file

@ -106,7 +106,6 @@ class BuildTriggerSubdirs(RepositoryParamResource):
'id': 'BuildTriggerSubdirRequest', 'id': 'BuildTriggerSubdirRequest',
'type': 'object', 'type': 'object',
'description': 'Arbitrary json.', 'description': 'Arbitrary json.',
'required': True,
}, },
} }
@ -150,7 +149,6 @@ class BuildTriggerActivate(RepositoryParamResource):
'id': 'BuildTriggerActivateRequest', 'id': 'BuildTriggerActivateRequest',
'type': 'object', 'type': 'object',
'description': 'Arbitrary json.', 'description': 'Arbitrary json.',
'required': True,
}, },
} }

View file

@ -67,22 +67,23 @@ class User(ApiResource):
'id': 'NewUser', 'id': 'NewUser',
'type': 'object', 'type': 'object',
'description': 'Fields which must be specified for a new user.', 'description': 'Fields which must be specified for a new user.',
'required': True, 'required': [
'username',
'password',
'email',
],
'properties': { 'properties': {
'username': { 'username': {
'type': 'string', 'type': 'string',
'description': 'The user\'s username', 'description': 'The user\'s username',
'required': True,
}, },
'password': { 'password': {
'type': 'string', 'type': 'string',
'description': 'The user\'s password', 'description': 'The user\'s password',
'required': True,
}, },
'email': { 'email': {
'type': 'string', 'type': 'string',
'description': 'The user\'s email address', 'description': 'The user\'s email address',
'required': True,
}, },
} }
}, },
@ -90,7 +91,6 @@ class User(ApiResource):
'id': 'UpdateUser', 'id': 'UpdateUser',
'type': 'object', 'type': 'object',
'description': 'Fields which can be updated in a user.', 'description': 'Fields which can be updated in a user.',
'required': True,
'properties': { 'properties': {
'password': { 'password': {
'type': 'string', 'type': 'string',
@ -225,22 +225,23 @@ class ConvertToOrganization(ApiResource):
'id': 'ConvertUser', 'id': 'ConvertUser',
'type': 'object', 'type': 'object',
'description': 'Information required to convert a user to an organization.', 'description': 'Information required to convert a user to an organization.',
'required': True, 'required': [
'username',
'password',
'email',
],
'properties': { 'properties': {
'username': { 'username': {
'type': 'string', 'type': 'string',
'description': 'The user\'s username', 'description': 'The user\'s username',
'required': True,
}, },
'password': { 'password': {
'type': 'string', 'type': 'string',
'description': 'The user\'s password', 'description': 'The user\'s password',
'required': True,
}, },
'email': { 'email': {
'type': 'string', 'type': 'string',
'description': 'The user\'s email address', 'description': 'The user\'s email address',
'required': True,
}, },
}, },
}, },
@ -286,17 +287,18 @@ class Signin(ApiResource):
'id': 'SigninUser', 'id': 'SigninUser',
'type': 'object', 'type': 'object',
'description': 'Information required to sign in a user.', 'description': 'Information required to sign in a user.',
'required': True, 'required': [
'username',
'password',
],
'properties': { 'properties': {
'username': { 'username': {
'type': 'string', 'type': 'string',
'description': 'The user\'s username', 'description': 'The user\'s username',
'required': True,
}, },
'password': { 'password': {
'type': 'string', 'type': 'string',
'description': 'The user\'s password', 'description': 'The user\'s password',
'required': True,
}, },
}, },
}, },
@ -337,12 +339,13 @@ class Recovery(ApiResource):
'id': 'RequestRecovery', 'id': 'RequestRecovery',
'type': 'object', 'type': 'object',
'description': 'Information required to sign in a user.', 'description': 'Information required to sign in a user.',
'required': True, 'required': [
'email',
],
'properties': { 'properties': {
'email': { 'email': {
'type': 'string', 'type': 'string',
'description': 'The user\'s email address', 'description': 'The user\'s email address',
'required': True,
}, },
}, },
}, },

View file

@ -21,7 +21,6 @@ class WebhookList(RepositoryParamResource):
'id': 'WebhookCreateRequest', 'id': 'WebhookCreateRequest',
'type': 'object', 'type': 'object',
'description': 'Arbitrary json.', 'description': 'Arbitrary json.',
'required': True,
}, },
} }