Skip to content

Vendoring of UUID generates conflicts #88

@thehgregor

Description

@thehgregor

What happened?

When errors reference a primitive of type UUID in an API definition, the code generated by Conjure Go doesn't compile.

API definition:

{
    "version": 1,
    "errors": [
        {
            "errorName": {
                "name": "MyError",
                "package": "uuid.api"
            },
            "docs": "Some error.\n",
            "namespace": "Sample",
            "code": "INVALID_ARGUMENT",
            "safeArgs": [
                {
                    "fieldName": "info",
                    "type": {
                        "type": "reference",
                        "reference": {
                            "name": "InfoType",
                            "package": "uuid.api"
                        }
                    },
                    "docs": null
                }
            ],
            "unsafeArgs": []
        }
    ],
    "types": [
        {
            "type": "object",
            "object": {
                "typeName": {
                    "name": "InfoType",
                    "package": "uuid.api"
                },
                "fields": [
                    {
                        "fieldName": "someField",
                        "type": {
                            "type": "primitive",
                            "primitive": "UUID"
                        },
                        "docs": "The UUID.\n"
                    }
                ],
                "docs": "Some UUID.\n"
            }
        }
    ],
    "services": [
        {
            "serviceName": {
                "name": "MyService",
                "package": "uuid.api.service"
            },
            "endpoints": [
                {
                    "endpointName": "getInfo",
                    "httpMethod": "GET",
                    "httpPath": "/info",
                    "auth": {
                        "type": "header",
                        "header": {}
                    },
                    "args": [],
                    "returns": {
                        "type": "reference",
                        "reference": {
                            "name": "InfoType",
                            "package": "uuid.api"
                        }
                    },
                    "docs": "Some information.\n",
                    "deprecated": null,
                    "markers": []
                }
            ],
            "docs": "Returns information.\n"
        }
    ]
}

Compile error:

# sample/uuid/api
../../../../go/src/sample/uuid/api/errors.conjure.go:77:115: cannot use e.errorInstanceID (type "github.com/palantir/pkg/uuid".UUID) as type "github.com/palantir/conjure-go-runtime/vendor/github.com/palantir/pkg/uuid".UUID in field value
../../../../go/src/sample/uuid/api/errors.conjure.go:89:20: cannot use serializableError.ErrorInstanceID (type "github.com/palantir/conjure-go-runtime/vendor/github.com/palantir/pkg/uuid".UUID) as type "github.com/palantir/pkg/uuid".UUID in assignment

Conjure Go issue palantir/conjure-go#78 might be related to this problem.

What did you want to happen?

Package github.com/palantir/pkg/uuid should not be vendored in conjure-go-runtime or a different strategy to avoid a conflict should be implemented in conjure-go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions