Openapi-generator: [Go] Is github.com/antihax/optional necessary?

Created on 4 Oct 2018  ·  13Comments  ·  Source: OpenAPITools/openapi-generator

Description

Hey! Thanks for the OpenAPI v3 support with Go. I was wondering about github.com/antihax/optional after generating a Go client. Is that library necessary? Could it just be unexported methods?

I ask because that project has one commit with no readme. What happens if that repository is taken over and a nefarious commit is pushed?

I'll offer to port that code over into the generate itself.

openapi-generator version

v3.3.0

OpenAPI declaration file content or url

https://github.com/moov-io/api

Most helpful comment

What about shipping the functions needed in a file (write it with the template)? i.e. optional.go

All 13 comments

cc @antihax

Best option is to vendor or fork it and modify the template.

The problem is we can't predict the package name inside of the template.

What about shipping the functions needed in a file (write it with the template)? i.e. optional.go

What about shipping the functions needed in a file (write it with the template)? i.e. optional.go

The path to the package is still unknown and I avoided putting them in the same package because it could (and did) collide with an API specification.

I think it would be better to put this into the OpenAPITools repo so it at least is known to come from the generator.

I think it would be better to put this into the OpenAPITools repo so it at least is known to come from the generator.

Sure we can fork github.com/antihax/optional to create github.com/openapitools/optional

  • we need to keep github.com/antihax/optional as many Go SDKs are still referencing it.
  • what about renaming "optional" to "gooptional"? (to make it clearer it's for Go)

Any other thoughts?

cc @OpenAPITools/generator-core-team

I am fine with renaming and keeping it around (i am using it anyway).

A shorter name would be nice: goopts? The name will get used a bit in the end developer code.

What is the status of it?
I keep getting the issue raised also in https://github.com/OpenAPITools/openapi-generator/issues/4083 using go 1.13
github.com/antihax/[email protected]: invalid pseudo-version: does not match version-control timestamp (2018-04-07T02:43:04Z)

Are you using the latest stable version?

在 2019年12月16日週一 下午10:36,Oleg Sucharevich notifications@github.com 寫道:

What is the status of it?
I just tried to run the golang generator with error:
github.com/antihax/[email protected]: invalid
pseudo-version: does not match version-control timestamp
(2018-04-07T02:43:04Z)


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/OpenAPITools/openapi-generator/issues/1176?email_source=notifications&email_token=AAHEC5FMFG7GI2ONFWQQWLDQY6HARA5CNFSM4FZCAK5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG65BHY#issuecomment-566087839,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAHEC5AOENKJZDROERPNUN3QY6HARANCNFSM4FZCAK5A
.

@wing328 latest I guess from example with Docker https://github.com/OpenAPITools/openapi-generator#16---docker

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
    -i https://g.codefresh.io/api/openapi.json \
    -g go \
    -o /local \
    --additional-properties=withGoCodegenComment=true

Please do a docker pull first

在 2019年12月18日週三 下午3:42,Oleg Sucharevich notifications@github.com 寫道:

@wing328 https://github.com/wing328 latest I guess from example with
Docker https://github.com/OpenAPITools/openapi-generator#16---docker

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i https://g.codefresh.io/api/openapi.json \
-g go \
-o /local \
--additional-properties=withGoCodegenComment=true


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/OpenAPITools/openapi-generator/issues/1176?email_source=notifications&email_token=AAHEC5EMJJFWAHQVM5Q4YEDQZHH57A5CNFSM4FZCAK5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHFHHIY#issuecomment-566916003,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAHEC5DF4TOQLCA2XXFTXETQZHH57ANCNFSM4FZCAK5A
.

It's almost 11 months. Is there any updates?

The go client generator in the latest master has been refactored. Can you give it a try?

Closed via #7692

Was this page helpful?
0 / 5 - 0 ratings