f-f / gogolica

Auto-generated Google APIs for Clojure
Eclipse Public License 1.0
2 stars 0 forks source link

Disallow some characters in bucket names #15

Open f-f opened 7 years ago

f-f commented 7 years ago

Not all the characters are allowed in bucket names: https://cloud.google.com/storage/docs/naming#objectnames

zudov commented 7 years ago

It appears like the spec doesn't specify any pattern, even though it could:

$ jq '.resources.buckets.methods.insert.request' storage-api.json                                                                                                                 
{                                                                                                                                                                                 
  "$ref": "Bucket"
}
$ jq '.schemas.Bucket.properties.name' storage-api.json                                                                                                                           
{                                                                                                                                                                                 
  "type": "string",
  "description": "The name of the bucket.",
  "annotations": {
    "required": [
      "storage.buckets.insert"
    ]
  }
}

We should flag it up and hopefully get the API discovery spec improved.

However, we also want to have a way to refine this kind of (and other) things when we generate our modules.

f-f commented 7 years ago

Terraform uses the following regex: '(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)'.