docusign / OpenAPI-Specifications

The official Docusign REST APIs Swagger Specifications
MIT License
19 stars 15 forks source link

E-Signature v2.1 Build Error in golang (duplicate "langCode") #91

Open aramcodz opened 9 months ago

aramcodz commented 9 months ago

Environment/Tools:

Problem Statement: While the go-swagger tooling does successfully generate the set of client/model objects needed for a golang client implementation of the Docusign eSignature v2.1 client , attempting to build those source files in go produces the following error:

$ go build ./...

# github.com/TheWeatherCompany/docusign-esign-client/gen/swagger/apis/v2_1/client/envelope_consumer_disclosures
gen/swagger/apis/v2_1/client/envelope_consumer_disclosures/consumer_disclosure_get_consumer_disclosure_envelope_id_recipient_id_lang_code_parameters.go:181:2: LangCode redeclared
    gen/swagger/apis/v2_1/client/envelope_consumer_disclosures/consumer_disclosure_get_consumer_disclosure_envelope_id_recipient_id_lang_code_parameters.go:129:2: other declaration of LangCode
gen/swagger/apis/v2_1/client/envelope_consumer_disclosures/consumer_disclosure_get_consumer_disclosure_envelope_id_recipient_id_lang_code_parameters.go:287:86: ConsumerDisclosureGetConsumerDisclosureEnvelopeIDRecipientIDLangCodeParams.WithLangCode redeclared in this block
    gen/swagger/apis/v2_1/client/envelope_consumer_disclosures/consumer_disclosure_get_consumer_disclosure_envelope_id_recipient_id_lang_code_parameters.go:276:86: other declaration of WithLangCode
gen/swagger/apis/v2_1/client/envelope_consumer_disclosures/consumer_disclosure_get_consumer_disclosure_envelope_id_recipient_id_lang_code_parameters.go:288:16: cannot use langCode (variable of type *string) as type string in argument to o.SetLangCode
gen/swagger/apis/v2_1/client/envelope_consumer_disclosures/consumer_disclosure_get_consumer_disclosure_envelope_id_recipient_id_lang_code_parameters.go:293:86: ConsumerDisclosureGetConsumerDisclosureEnvelopeIDRecipientIDLangCodeParams.SetLangCode redeclared in this block
    gen/swagger/apis/v2_1/client/envelope_consumer_disclosures/consumer_disclosure_get_consumer_disclosure_envelope_id_recipient_id_lang_code_parameters.go:282:86: other declaration of SetLangCode
gen/swagger/apis/v2_1/client/envelope_consumer_disclosures/consumer_disclosure_get_consumer_disclosure_envelope_id_recipient_id_lang_code_parameters.go:294:15: cannot use langCode (variable of type *string) as type string in assignment
gen/swagger/apis/v2_1/client/envelope_consumer_disclosures/consumer_disclosure_get_consumer_disclosure_envelope_id_recipient_id_lang_code_parameters.go:331:19: invalid operation: o.LangCode != nil (mismatched types string and untyped nil)
gen/swagger/apis/v2_1/client/envelope_consumer_disclosures/consumer_disclosure_get_consumer_disclosure_envelope_id_recipient_id_lang_code_parameters.go:336:20: invalid operation: o.LangCode != nil (mismatched types string and untyped nil)
gen/swagger/apis/v2_1/client/envelope_consumer_disclosures/consumer_disclosure_get_consumer_disclosure_envelope_id_recipient_id_lang_code_parameters.go:337:18: invalid operation: cannot indirect o.LangCode (variable of type string)

The issue appears to be a possible duplicate "langCode" Param in the "/v2.1/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/consumer_disclosure/{langCode}" section (~ line 8637)

Also, as per the description of that endpoint:

Retrieves the HTML-formatted Electronic Record and Signature Disclosure (ERSD) for the envelope recipient that you specify. This disclosure might differ from the account-level disclosure, based on the signing brand applied to the envelope and the recipient's language settings.\n\nTo set the language of the disclosure that you want to retrieve, specify the langCode as either a path or query parameter.

Why would I do this: specify the langCode as either a path or query parameter? That seems confusing. Wouldn't it just makes more sense, and clarify the intent of, and simplify, the API, to choose one parameter approach.

NOTE: that the successful generation of the golang client source is done using the --skip-validation argument when running the go-swagger, which is why I believe that the code generation succeeds at all.

This feels like a basic OpenAPI validation issue in https://github.com/docusign/OpenAPI-Specifications/blob/master/esignature.rest.swagger-v2.1.json that should be fixed.

aramcodz commented 9 months ago

I created a PR for a suggested fix. https://github.com/docusign/OpenAPI-Specifications/pull/92