Skip to content

Commit

Permalink
chore: DocEndpointTypeBoolean, DocEndpointTypeObject and DocEndpointT…
Browse files Browse the repository at this point in the history
…ypeArray
  • Loading branch information
vinyguedess committed Jun 20, 2022
1 parent be77ea3 commit a67f901
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
11 changes: 7 additions & 4 deletions documentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const (
const (
DocEndpointTypeString DocEndpointType = "string"
DocEndpointTypeInteger DocEndpointType = "integer"
DocEndpointTypeBoolean DocEndpointType = "boolean"
DocEndpointTypeObject DocEndpointType = "object"
DocEndpointTypeArray DocEndpointType = "array"
)

type DocAppInfo struct {
Expand Down Expand Up @@ -84,7 +87,7 @@ type DocEndpointParameter struct {
}

type DocEndpointDefinition struct {
Type string `json:"type"`
Type DocEndpointType `json:"type"`
Properties map[string]DocEndpointParameter `json:"properties"`
}

Expand All @@ -96,9 +99,9 @@ type DocEndpointParameterItem struct {
}

type DocEndpointSchema struct {
Type string `json:"type,omitempty"`
Ref string `json:"$ref,omitempty"`
AdditionalProperties bool `json:"additionalProperties,omitempty"`
Type DocEndpointType `json:"type,omitempty"`
Ref string `json:"$ref,omitempty"`
AdditionalProperties bool `json:"additionalProperties,omitempty"`
}

func NewDocApp(title string, version string) DocApp {
Expand Down
6 changes: 3 additions & 3 deletions documentation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func Test_AddEndpointToDocs_EndpointDefinitions(t *testing.T) {
},
Definitions: map[string]DocEndpointDefinition{
"TestObject": {
Type: "object",
Type: DocEndpointTypeObject,
Properties: map[string]DocEndpointParameter{
"name": {
Type: "string",
Expand Down Expand Up @@ -168,7 +168,7 @@ func Test_AddEndpointToDocs_EndpointDefinitions(t *testing.T) {
},
Definitions: map[string]DocEndpointDefinition{
"TestObject": {
Type: "object",
Type: DocEndpointTypeObject,
Properties: map[string]DocEndpointParameter{
"name": {
Type: "string",
Expand All @@ -186,7 +186,7 @@ func Test_AddEndpointToDocs_EndpointDefinitions(t *testing.T) {
t,
map[string]DocEndpointDefinition{
"TestObject": {
Type: "object",
Type: DocEndpointTypeObject,
Properties: map[string]DocEndpointParameter{
"name": {
Type: "string",
Expand Down
2 changes: 1 addition & 1 deletion examples/swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func main() {
},
Definitions: map[string]geh.DocEndpointDefinition{
"TestObject": {
Type: "object",
Type: geh.DocEndpointTypeObject,
Properties: map[string]geh.DocEndpointParameter{
"name": {
Type: geh.DocEndpointTypeString,
Expand Down

0 comments on commit a67f901

Please sign in to comment.