-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the rest of the primitive types (#17)
This adds the rest of the primitive types in the schema (+ OpenAPI / proto writing)
- Loading branch information
1 parent
80bb3d9
commit 6b85db5
Showing
10 changed files
with
315 additions
and
131 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
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
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,43 @@ | ||
package openapi | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/aep-dev/aepc/schema" | ||
) | ||
|
||
type TypeInfo struct { | ||
openapi_type string | ||
openapi_format string | ||
} | ||
|
||
func openAPIType(p *schema.Property) (TypeInfo, error) { | ||
t := ""; | ||
f := ""; | ||
|
||
switch(p.Type) { | ||
case schema.Type_STRING: | ||
t = "string" | ||
case schema.Type_DOUBLE: | ||
t = "number" | ||
f = "double" | ||
case schema.Type_FLOAT: | ||
t = "number" | ||
f = "float" | ||
case schema.Type_INT32: | ||
t = "integer" | ||
f = "int32" | ||
case schema.Type_INT64: | ||
t = "integer" | ||
f = "int64" | ||
case schema.Type_BOOLEAN: | ||
t = "boolean" | ||
default: | ||
return TypeInfo{}, fmt.Errorf("%s does not have openapi type support", p.Type) | ||
} | ||
|
||
return TypeInfo{ | ||
openapi_type: t, | ||
openapi_format: f, | ||
}, 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