Skip to content

[BUG]gen model-package with relative path has incorrect imports from v0.25.0 #2608

@kaisawind

Description

@kaisawind

Problem statement

gen model-package with relative path has incorrect imports from v0.25.0

Command

swagger generate server -P v1.Principal -A iotx -t ./ -f ./swagger/swagger.yaml --model-package=../pkg/endpoint/v1

Imports

v0.24.0

...
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command

import (
	"net/http"

	"github.com/go-openapi/runtime/middleware"

	v1 "github.com/kaisawind/iotx/pkg/endpoint/v1"
)
...

v0.25.0

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command

import (
	"net/http"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime/middleware"
	"github.com/go-openapi/runtime/security"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"

	"github.com/kaisawind/iotx/apiserver/restapi/operations"
	"github.com/kaisawind/iotx/apiserver/restapi/operations/command"
	"github.com/kaisawind/iotx/apiserver/restapi/operations/device"
	"github.com/kaisawind/iotx/apiserver/restapi/operations/logr"
	"github.com/kaisawind/iotx/apiserver/restapi/operations/oauth"
	"github.com/kaisawind/iotx/apiserver/restapi/operations/product"
	"github.com/kaisawind/iotx/apiserver/restapi/operations/rule"
	"github.com/kaisawind/iotx/apiserver/restapi/operations/system"
	"github.com/kaisawind/iotx/apiserver/restapi/operations/topic"
	"github.com/kaisawind/iotx/apiserver/restapi/operations/user"
	"github.com/kaisawind/iotx/pkg/endpoint/v1"
)

v0.24.0 ✔️
v0.25.0 ❌
v0.26.0 ❌
v0.27.0 ❌

Swagger specification

Has nothing to do with swagger

Steps to reproduce

swagger generate server -P v1.Principal -A iotx -t ./ -f ./swagger/swagger.yaml --model-package=../pkg/endpoint/v1

Environment

swagger version: 0.27.0
go version: 1.16.5
OS: Linux 5.10.42-1-MANJARO

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