-
-
Notifications
You must be signed in to change notification settings - Fork 813
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d326c01
commit 6f01e97
Showing
12 changed files
with
407 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package client | ||
|
||
//go:generate go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen --package=filtertags --generate=server -o tags/server.gen.go -include-tags included-tag1,included-tag2 server.yaml | ||
//go:generate go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen --package=filteroperations --generate=server -o operations/server.gen.go -include-operation-ids included-operation1,included-operation2 server.yaml |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package filteroperations | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/labstack/echo/v4" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
type server struct{} | ||
|
||
func (s server) IncludedOperation1(ctx echo.Context) error { | ||
return nil | ||
} | ||
|
||
func (s server) IncludedOperation2(ctx echo.Context) error { | ||
return nil | ||
} | ||
|
||
func TestServer(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
var s ServerInterface = server{} | ||
assert.NoError(s.IncludedOperation1(nil)) | ||
assert.NoError(s.IncludedOperation2(nil)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
openapi: "3.0.1" | ||
info: | ||
version: 1.0.0 | ||
title: Test Server | ||
license: | ||
name: MIT | ||
description: | | ||
This tests whether filtering works correctly | ||
paths: | ||
/included1: | ||
get: | ||
operationId: included-operation1 | ||
tags: | ||
- included-tag1 | ||
responses: | ||
200: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/SchemaObject' | ||
/filtered: | ||
get: | ||
operationId: filtered-operation | ||
tags: | ||
- filtered-tag | ||
responses: | ||
200: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/SchemaObject' | ||
/included2: | ||
get: | ||
operationId: included-operation2 | ||
tags: | ||
- included-tag2 | ||
responses: | ||
200: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/SchemaObject' | ||
|
||
components: | ||
schemas: | ||
SchemaObject: | ||
properties: | ||
firstName: | ||
type: string | ||
required: | ||
- firstName |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package filtertags | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/labstack/echo/v4" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
type server struct{} | ||
|
||
func (s server) IncludedOperation1(ctx echo.Context) error { | ||
return nil | ||
} | ||
|
||
func (s server) IncludedOperation2(ctx echo.Context) error { | ||
return nil | ||
} | ||
|
||
func TestServer(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
var s ServerInterface = server{} | ||
assert.NoError(s.IncludedOperation1(nil)) | ||
assert.NoError(s.IncludedOperation2(nil)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.