diff --git a/codegen/JsonDescriptionOfGithubApiV3/description.human_readable.json b/codegen/JsonDescriptionOfGithubApiV3/description.human_readable.json index 30ac1f1f..707fa21a 100644 --- a/codegen/JsonDescriptionOfGithubApiV3/description.human_readable.json +++ b/codegen/JsonDescriptionOfGithubApiV3/description.human_readable.json @@ -390,7 +390,7 @@ { "name": "actor", "type": "NamedUser" }, { "name": "created_at", "type": "string" }, { "name": "id", "type": "string" }, - { "name": "payload", "type": "@todo" }, + { "name": "payload", "type": "dict" }, { "name": "public", "type": "bool" }, { "name": "type", "type": "string" }, { "name": "org", "type": "Organization" }, @@ -625,7 +625,7 @@ "edit": { "mandatoryParameters": [ { "name": "name", "type": "string" }, - { "name": "config", "type": "@todo" } + { "name": "config", "type": "dict" } ], "optionalParameters": [ { "name": "events", "type": "list:string" }, @@ -637,7 +637,7 @@ "delete": true, "attributes": [ { "name": "active", "type": "bool" }, - { "name": "config", "type": "@todo" }, + { "name": "config", "type": "dict" }, { "name": "created_at", "type": "string" }, { "name": "events", "type": "list:string" }, { "name": "id", "type": "integer" }, @@ -1542,7 +1542,7 @@ "createElement": { "mandatoryParameters": [ { "name": "name", "type": "string" }, - { "name": "config", "type": "@todo" } + { "name": "config", "type": "dict" } ], "optionalParameters": [ { "name": "events", "type": "list:string" }, diff --git a/codegen/JsonDescriptionOfGithubApiV3/description.normalized.json b/codegen/JsonDescriptionOfGithubApiV3/description.normalized.json index 70884bdc..ac22ceb9 100644 --- a/codegen/JsonDescriptionOfGithubApiV3/description.normalized.json +++ b/codegen/JsonDescriptionOfGithubApiV3/description.normalized.json @@ -2314,7 +2314,7 @@ "type": { "simple": true, "cardinality": "scalar", - "name": "@todo" + "name": "dict" }, "name": "payload" }, @@ -3455,7 +3455,7 @@ "type": { "simple": true, "cardinality": "scalar", - "name": "@todo" + "name": "dict" }, "name": "config" }, @@ -3537,7 +3537,7 @@ "type": { "simple": true, "cardinality": "scalar", - "name": "@todo" + "name": "dict" }, "name": "config" } @@ -8840,7 +8840,7 @@ "type": { "simple": true, "cardinality": "scalar", - "name": "@todo" + "name": "dict" }, "name": "config" } diff --git a/codegen/JsonDescriptionOfGithubApiV3/normalize.py b/codegen/JsonDescriptionOfGithubApiV3/normalize.py index 29fa546c..9e4ffde0 100644 --- a/codegen/JsonDescriptionOfGithubApiV3/normalize.py +++ b/codegen/JsonDescriptionOfGithubApiV3/normalize.py @@ -32,7 +32,7 @@ class Type: return { "cardinality": self.cardinality, "name": self.name, - "simple": self.name in [ "void", "string", "integer", "bool", "float", "@todo" ], + "simple": self.name in [ "void", "string", "integer", "bool", "float", "dict", "@todo" ], } def __fromString( self, name ): diff --git a/codegen/templates/GithubObject.Implementation.py b/codegen/templates/GithubObject.Implementation.py index 027e1326..6ed2f53e 100644 --- a/codegen/templates/GithubObject.Implementation.py +++ b/codegen/templates/GithubObject.Implementation.py @@ -25,6 +25,9 @@ {% if attribute.type.name == "bool" %} assert attributes[ "{{ attribute.name }}" ] is None or isinstance( attributes[ "{{ attribute.name }}" ], bool ), attributes[ "{{ attribute.name }}" ] {% endif %} + {% if attribute.type.name == "dict" %} + assert attributes[ "{{ attribute.name }}" ] is None or isinstance( attributes[ "{{ attribute.name }}" ], dict ), attributes[ "{{ attribute.name }}" ] + {% endif %} {% else %} assert attributes[ "{{ attribute.name }}" ] is None or isinstance( attributes[ "{{ attribute.name }}" ], dict ), attributes[ "{{ attribute.name }}" ] {% endif %} diff --git a/codegen/templates/GithubObject.MethodBody.CheckArguments.py b/codegen/templates/GithubObject.MethodBody.CheckArguments.py index 40c63e2e..8f51f0c9 100644 --- a/codegen/templates/GithubObject.MethodBody.CheckArguments.py +++ b/codegen/templates/GithubObject.MethodBody.CheckArguments.py @@ -11,6 +11,9 @@ {% if parameter.type.name == "bool" %} assert isinstance( {{ parameter.name }}, bool ), {{ parameter.name }} {% endif %} + {% if parameter.type.name == "dict" %} + assert isinstance( {{ parameter.name }}, dict ), {{ parameter.name }} + {% endif %} {% else %} assert isinstance( {{ parameter.name }}, {{ parameter.type.name }}.{{ parameter.type.name }} ), {{ parameter.name }} {% endif %} @@ -46,6 +49,9 @@ {% if parameter.type.name == "bool" %} assert {{ parameter.name }} is GithubObject.NotSet or isinstance( {{ parameter.name }}, bool ), {{ parameter.name }} {% endif %} + {% if parameter.type.name == "dict" %} + assert {{ parameter.name }} is GithubObject.NotSet or isinstance( {{ parameter.name }}, dict ), {{ parameter.name }} + {% endif %} {% else %} assert {{ parameter.name }} is GithubObject.NotSet or isinstance( {{ parameter.name }}, {{ parameter.type.name }}.{{ parameter.type.name }} ), {{ parameter.name }} {% endif %} diff --git a/doc/ReferenceOfClasses.md b/doc/ReferenceOfClasses.md index f4f4f382..f3581def 100644 --- a/doc/ReferenceOfClasses.md +++ b/doc/ReferenceOfClasses.md @@ -307,7 +307,7 @@ Attributes * `created_at`: string * `id`: string * `org`: `Organization` -* `payload` +* `payload`: dict * `public`: bool * `repo`: `Repository` * `type`: string @@ -508,7 +508,7 @@ Class `Hook` Attributes ---------- * `active`: bool -* `config` +* `config`: dict * `created_at`: string * `events`: list of string * `id`: integer @@ -525,7 +525,7 @@ Modification ------------ * `edit( name, config, [events, add_events, remove_events, active] )` * `name`: string - * `config` + * `config`: dict * `events`: list of string * `add_events`: list of string * `remove_events`: list of string @@ -1134,7 +1134,7 @@ Hooks ----- * `create_hook( name, config, [events, active] )`: `Hook` * `name`: string - * `config` + * `config`: dict * `events`: list of string * `active`: bool * `get_hook( id )`: `Hook` diff --git a/src/github/Event.py b/src/github/Event.py index a2d908fd..28df0d65 100644 --- a/src/github/Event.py +++ b/src/github/Event.py @@ -64,6 +64,7 @@ class Event( GithubObject.BasicGithubObject ): assert attributes[ "org" ] is None or isinstance( attributes[ "org" ], dict ), attributes[ "org" ] self._org = None if attributes[ "org" ] is None else Organization.Organization( self._requester, attributes[ "org" ], completed = False ) if "payload" in attributes: # pragma no branch + assert attributes[ "payload" ] is None or isinstance( attributes[ "payload" ], dict ), attributes[ "payload" ] self._payload = attributes[ "payload" ] if "public" in attributes: # pragma no branch assert attributes[ "public" ] is None or isinstance( attributes[ "public" ], bool ), attributes[ "public" ] diff --git a/src/github/Hook.py b/src/github/Hook.py index fb8bf97b..14149065 100644 --- a/src/github/Hook.py +++ b/src/github/Hook.py @@ -62,6 +62,7 @@ class Hook( GithubObject.GithubObject ): def edit( self, name, config, events = GithubObject.NotSet, add_events = GithubObject.NotSet, remove_events = GithubObject.NotSet, active = GithubObject.NotSet ): assert isinstance( name, ( str, unicode ) ), name + assert isinstance( config, dict ), config assert events is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in events ), events assert add_events is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in add_events ), add_events assert remove_events is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in remove_events ), remove_events @@ -112,6 +113,7 @@ class Hook( GithubObject.GithubObject ): assert attributes[ "active" ] is None or isinstance( attributes[ "active" ], bool ), attributes[ "active" ] self._active = attributes[ "active" ] if "config" in attributes: # pragma no branch + assert attributes[ "config" ] is None or isinstance( attributes[ "config" ], dict ), attributes[ "config" ] self._config = attributes[ "config" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] diff --git a/src/github/Repository.py b/src/github/Repository.py index d53fb79d..0d5d4f4a 100644 --- a/src/github/Repository.py +++ b/src/github/Repository.py @@ -320,6 +320,7 @@ class Repository( GithubObject.GithubObject ): def create_hook( self, name, config, events = GithubObject.NotSet, active = GithubObject.NotSet ): assert isinstance( name, ( str, unicode ) ), name + assert isinstance( config, dict ), config assert events is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in events ), events assert active is GithubObject.NotSet or isinstance( active, bool ), active post_parameters = {