Skip to content

Conversation

ldez
Copy link

@ldez ldez commented Oct 13, 2024

The module name is invalid:

module github.com/GIT_USER_ID/GIT_REPO_ID

I generated the code with the following command:

docker run --rm \
-v ${PWD}:/local -w /local openapitools/openapi-generator-cli:v7.0.0 generate \
-i ./api/openapi.yaml \
-g go \
-o ./ \
--git-repo-id sdk-go --git-user-id timeweb-cloud \
--skip-validate-spec

Note the usage of --git-repo-id sdk-go --git-user-id timeweb-cloud

Also after the generation, you should run go mod tidy.

@ldez
Copy link
Author

ldez commented Oct 13, 2024

Also, even with my fix, this module doesn't compile:

$ go build         
# github.com/timeweb-cloud/sdk-go
./model_image_status.go:25:2: CREATED redeclared in this block
        ./model_deploy_status.go:24:2: other declaration of CREATED
./model_setting_condition.go:24:2: ON redeclared in this block
        ./model_notification_setting_channel.go:24:2: other declaration of ON
./model_setting_condition.go:25:2: OFF redeclared in this block
        ./model_notification_setting_channel.go:25:2: other declaration of OFF
./model_setting_condition.go:26:2: DISABLED_ON redeclared in this block
        ./model_notification_setting_channel.go:26:2: other declaration of DISABLED_ON
./model_url_status.go:25:2: FAILED redeclared in this block
        ./model_image_status.go:26:2: other declaration of FAILED
./api_s3.go:3185:11: undefined: os
./api_s3.go:3189:55: undefined: os

The following command can fix the redeclared constants (FAILED redeclared in this block):

docker run --rm \
-v ${PWD}:/local -w /local openapitools/openapi-generator-cli:v7.0.0 generate \
-i ./api/openapi.yaml \
-g go \
-o ./ \
--additional-properties=enumClassPrefix=true,withGoMod=false \
--git-repo-id sdk-go --git-user-id timeweb-cloud \
--skip-validate-spec

Note: --additional-properties=enumClassPrefix=true,withGoMod=false

But there is a problem with file type (api_s3.go): based on the documentation, the type File is not supported with OAS3.

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

Successfully merging this pull request may close these issues.

1 participant