abujehad139 / google-api-go-client

Automatically exported from code.google.com/p/google-api-go-client
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

code generator doesn't handle additionalProperties configuration directive #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Generate code for 
https://www.googleapis.com/discovery/v1/apis/datastore/v1beta1/rest for the 
following schema:
  "Entity": {
   "id": "Entity",
   "type": "object",
   "properties": {
    "key": {
     "$ref": "Key",
     "description": "The entity's key.\n\nAn entity must have a key, unless otherwise documented (for example, an entity in Value.entityValue may have no key). An entity's kind is its key's path's last element's kind, or null if it has no key."
    },
    "properties": {
     "type": "object",
     "description": "The entity's properties.",
     "additionalProperties": {
      "$ref": "Property",
      "description": "The name of the property. Properties with names matching regex \"__.*__\" are reserved. A reserved property name is forbidden in certain documented contexts. The name cannot be \"\"."
     }
    }
   }
  },

What is the expected output? What do you see instead?

EntityProperty should be a type alias for map[string]Property.

Instead it is an empty struct:
https://code.google.com/p/google-api-go-client/source/browse/datastore/v1beta2/d
atastore-gen.go#150

What version of the product are you using? On what operating system?

v1beta2

Original issue reported on code.google.com by pro...@google.com on 30 Dec 2013 at 9:24

GoogleCodeExporter commented 9 years ago
I attached a patch that I believe fixes the problem.

Original comment by razv...@google.com on 31 Jan 2014 at 4:48

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by gmle...@google.com on 16 Apr 2014 at 3:46

GoogleCodeExporter commented 9 years ago
Note: some time ago I uploaded a code review for this on codereview site: 
https://codereview.appspot.com/57900045/

Original comment by razv...@google.com on 16 Apr 2014 at 3:52

GoogleCodeExporter commented 9 years ago
I'm seeing this same issue on the compute apis v1. The 
compute.instances.aggregatedList call returns a list of items that should be a 
map of string (zone) and InstancesScopedList, and instead it maps to an empty 
struct.

Original comment by charlie....@gmail.com on 12 May 2014 at 5:12

GoogleCodeExporter commented 9 years ago
I now have a new version that I believe will solve these problems 
(unfortunately the suggested patch was out of date), but I need a simple test 
case to verify that it works.

https://codereview.appspot.com/115890043

If anyone has a simple test case using any API that demonstrates the problem, 
please let me know.
Otherwise, I will work on coming up with an example.
Thanks.

Original comment by gmle...@google.com on 18 Jul 2014 at 12:54

GoogleCodeExporter commented 9 years ago
Fixed as of: 
https://code.google.com/p/google-api-go-client/source/detail?r=92077dbb4be1

Original comment by gmle...@google.com on 18 Jul 2014 at 5:34