Use a config to generate swagger api types

Moves the resposne types to a package under api/types

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2016-10-14 16:20:13 -04:00
parent 8f81bb92a3
commit 29df3bdb11
14 changed files with 24 additions and 12 deletions

View file

@ -5,8 +5,8 @@ import (
"net/http"
"github.com/docker/docker/api/server/httputils"
volumetypes "github.com/docker/docker/api/server/types/volume"
"github.com/docker/docker/api/types"
volumetypes "github.com/docker/docker/api/types/volume"
"golang.org/x/net/context"
)

12
api/swagger-gen.yaml Normal file
View file

@ -0,0 +1,12 @@
layout:
models:
- name: definition
source: asset:model
target: "{{ joinFilePath .Target .ModelPackage }}"
file_name: "{{ (snakize (pascalize .Name)) }}.go"
operations:
- name: handler
source: asset:serverOperation
target: "{{ joinFilePath .Target .APIPackage .Package }}"
file_name: "{{ (snakize (pascalize .Name)) }}.go"

View file

@ -5,7 +5,7 @@ import (
"golang.org/x/net/context"
volumetypes "github.com/docker/docker/api/server/types/volume"
volumetypes "github.com/docker/docker/api/types/volume"
"github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/opts"

View file

@ -4,7 +4,6 @@ import (
"io"
"time"
volumetypes "github.com/docker/docker/api/server/types/volume"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/events"
@ -12,6 +11,7 @@ import (
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/api/types/swarm"
volumetypes "github.com/docker/docker/api/types/volume"
"golang.org/x/net/context"
)

View file

@ -3,8 +3,8 @@ package client
import (
"encoding/json"
volumetypes "github.com/docker/docker/api/server/types/volume"
"github.com/docker/docker/api/types"
volumetypes "github.com/docker/docker/api/types/volume"
"golang.org/x/net/context"
)

View file

@ -9,8 +9,8 @@ import (
"strings"
"testing"
volumetypes "github.com/docker/docker/api/server/types/volume"
"github.com/docker/docker/api/types"
volumetypes "github.com/docker/docker/api/types/volume"
"golang.org/x/net/context"
)

View file

@ -4,8 +4,8 @@ import (
"encoding/json"
"net/url"
volumetypes "github.com/docker/docker/api/server/types/volume"
"github.com/docker/docker/api/types/filters"
volumetypes "github.com/docker/docker/api/types/volume"
"golang.org/x/net/context"
)

View file

@ -9,9 +9,9 @@ import (
"strings"
"testing"
volumetypes "github.com/docker/docker/api/server/types/volume"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
volumetypes "github.com/docker/docker/api/types/volume"
"golang.org/x/net/context"
)

View file

@ -9,12 +9,12 @@ import (
"github.com/Sirupsen/logrus"
volumetypes "github.com/docker/docker/api/server/types/volume"
"github.com/docker/docker/api/types"
enginecontainer "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/network"
volumetypes "github.com/docker/docker/api/types/volume"
clustertypes "github.com/docker/docker/daemon/cluster/provider"
"github.com/docker/docker/reference"
"github.com/docker/swarmkit/agent/exec"

View file

@ -2,7 +2,7 @@
set -eu
swagger generate model -f api/swagger.yaml \
-t api -m types --skip-validator \
-t api -m types --skip-validator -C api/swagger-gen.yaml \
-n Volume \
-n Port \
-n ImageSummary \
@ -10,7 +10,7 @@ swagger generate model -f api/swagger.yaml \
-n ErrorResponse
swagger generate operation -f api/swagger.yaml \
-t api -s server -a types -m types \
-t api -a types -m types -C api/swagger-gen.yaml \
-T api/templates --skip-responses --skip-parameters --skip-validator \
-n VolumesList \
-n VolumesCreate

View file

@ -5,8 +5,8 @@ import (
"net/http"
"path/filepath"
volumetypes "github.com/docker/docker/api/server/types/volume"
"github.com/docker/docker/api/types"
volumetypes "github.com/docker/docker/api/types/volume"
"github.com/docker/docker/pkg/integration/checker"
"github.com/go-check/check"
)

View file

@ -22,8 +22,8 @@ import (
"strings"
"time"
volumetypes "github.com/docker/docker/api/server/types/volume"
"github.com/docker/docker/api/types"
volumetypes "github.com/docker/docker/api/types/volume"
"github.com/docker/docker/opts"
"github.com/docker/docker/pkg/httputils"
icmd "github.com/docker/docker/pkg/integration/cmd"