Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: WEOS-1382 As a developer I should be able to set the type of id that I want auto generated #140

Merged
merged 32 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4ca68b3
feature: WEOS-1382 Auto generate id
akeemphilbert Mar 4, 2022
0ab931f
feature: WEOS-1382 Auto generate id
akeemphilbert Mar 4, 2022
46a5eb1
Merge branch 'feature/WEOS-1382' into WEOS-1392
shaniah868 Mar 7, 2022
ab7a1f6
feature: WEOS-1392 Generate and ensure bdd test passes
shaniah868 Mar 7, 2022
b294eba
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 9, 2022
a92575c
Merge branch 'WEOS-1391' into WEOS-1392
shaniah868 Mar 9, 2022
81e38b3
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 9, 2022
5295657
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 9, 2022
af4e8e1
doc: WEOS-1382 Update spec to make it that format needs to be specifi…
akeemphilbert Mar 9, 2022
627054a
Merge branch 'feature/WEOS-1382' into WEOS-1392
shaniah868 Mar 9, 2022
7c20720
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 9, 2022
89f6e71
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 9, 2022
901d16a
Merge branch 'WEOS-1391' into WEOS-1392
shaniah868 Mar 9, 2022
5ebe680
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 9, 2022
5e169e9
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 9, 2022
c374436
Merge pull request #138 from wepala/WEOS-1391
RandyDeo Mar 9, 2022
d67df67
Merge branch 'feature/WEOS-1382' into WEOS-1392
shaniah868 Mar 9, 2022
8fb13eb
Merge branch 'dev' into feature/WEOS-1382
shaniah868 Mar 9, 2022
d4b81d2
Merge branch 'feature/WEOS-1382' into WEOS-1392
shaniah868 Mar 9, 2022
8406285
Merge pull request #139 from wepala/WEOS-1392
RandyDeo Mar 9, 2022
0d919d8
doc: WEOS-1392 removed the erroneous bdd test step
akeemphilbert Mar 11, 2022
23f454f
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 11, 2022
5791590
Merge branch 'dev' into feature/WEOS-1382
shaniah868 Mar 11, 2022
83c5c63
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 11, 2022
9483996
feature: WEOS-1382 Auto generate id
akeemphilbert Mar 11, 2022
4515aaa
feature: WEOS-1382 Fixed a few more tests
akeemphilbert Mar 11, 2022
70c846c
Merge pull request #141 from wepala/feature/WEOS-1382-akeem
shaniah868 Mar 14, 2022
c836a62
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 14, 2022
5cec397
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 14, 2022
24aaa24
feature: WEOS-1382 As a developer I should be able to set the type of…
shaniah868 Mar 14, 2022
939ab8f
Merge branch 'dev' into feature/WEOS-1382
shaniah868 Mar 14, 2022
5da3f2b
Merge branch 'dev' into feature/WEOS-1382
shaniah868 Mar 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ components:
type: object
properties:
id:
type: string
format: ksuid
type: integer
format: uint
firstName:
type: string
lastName:
Expand All @@ -60,7 +60,6 @@ components:
- lastName
x-identifier:
- id
- email
Blog:
type: object
properties:
Expand Down
19 changes: 14 additions & 5 deletions controllers/rest/fixtures/blog-x-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ components:
Category:
type: object
properties:
title:
id:
type: string
format: uuid
description:
type: string
required:
- title
- id
x-identifier:
- title
- id
Author:
type: object
properties:
Expand All @@ -58,7 +59,6 @@ components:
- lastName
x-identifier:
- id
- email
Blog:
type: object
properties:
Expand Down Expand Up @@ -115,6 +115,15 @@ components:
created:
type: string
format: date-time
Archives:
type: object
properties:
id:
type: integer
title:
type: string
x-identifier:
- id
paths:
/health:
summary: Health Check
Expand Down Expand Up @@ -605,4 +614,4 @@ paths:
summary: Delete author
responses:
200:
description: Delete author
description: Delete author
17 changes: 14 additions & 3 deletions controllers/rest/middleware_initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ func newSchema(ref *openapi3.Schema, logger echo.Logger) (ds.Builder, map[string
relations[name] = strings.TrimPrefix(p.Ref, "#/components/schemas/")
} else {
t := p.Value.Type
f := p.Value.Format
if strings.EqualFold(t, "array") {
t2 := p.Value.Items.Value.Type
if t2 != "object" {
Expand All @@ -133,7 +134,12 @@ func newSchema(ref *openapi3.Schema, logger echo.Logger) (ds.Builder, map[string
} else if t2 == "number" {
instance.AddField(name, []float64{}, tagString)
} else if t == "integer" {
instance.AddField(name, []int{}, tagString)
if f == "uint" {
instance.AddField(name, []uint{}, tagString)
} else {
instance.AddField(name, []int{}, tagString)
}

} else if t == "boolean" {
instance.AddField(name, []bool{}, tagString)
}
Expand Down Expand Up @@ -166,8 +172,13 @@ func newSchema(ref *openapi3.Schema, logger echo.Logger) (ds.Builder, map[string
var numbers *float32
defaultValue = numbers
case "integer":
var integers *int
defaultValue = integers
if f == "uint" {
defaultValue = uint(0)
} else {
var integers *int
defaultValue = integers
}

case "boolean":
var boolean *bool
defaultValue = boolean
Expand Down
Loading