Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aramcodz opened this issue Nov 7, 2023 · 1 comment
Open

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

aramcodz opened this issue Nov 7, 2023 · 1 comment

Comments

@aramcodz
Copy link

aramcodz commented Nov 7, 2023

Environment/Tools:

  • e-Signature REST OpenAPI Specification v2.1
  • Go-Swagger version: v0.30.5 (commit: ab6a7885723430004f1d7db6395369b6e7f3370b)
  • golang version: go1.19.7 darwin/arm64 (on iOS)

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
Copy link
Author

aramcodz commented Nov 7, 2023

I created a PR for a suggested fix. #92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant