这是indexloc提供的服务,不要输入任何密码
Skip to content

apihub apis versions specs update - incorrectly builds updateMask #498

@kurtkanaskie

Description

@kurtkanaskie

The following fails

gorun --org=$ORG --region=us-central1 apihub apis versions specs update \
    --api-id=apigeecli-api-v1 \
    --id=spec-v1_0_0_0 \
    --version=v1_0_0_0 \
    --display-name=apigeecli-api-v1-spec-v1_0_0_0 \
    --file=apihub/foodtrucks.yaml
{
  "error": {
    "code": 400,
    "message": "source_uri cannot be updated if spec contains contents",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "SPEC_INVALID_ARGUMENT",
        "domain": "apihub.googleapis.com"
      }
    ]
  }
}

Couple issues:
spec_type cannot be specified in updateMask
documentation is not supported in updateMask
contents and source_uri are mutually exclusive.
See docs for details: https://cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs/patch

In hub.go

q.Set("updateMask", "display_name,source_uri,documentation,contents,spec_type")

should be built dynamically based on the input command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions