Skip to content

Commit 9f07c61

Browse files
authored
fix(oas): update aep-lib-go, add contact (#62)
Updated aep-lib-go to pick up new OAS changes, and support specifying a contact.
1 parent 6fa792d commit 9f07c61

9 files changed

Lines changed: 403 additions & 211 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
main
2-
terraform-provider-bookstore
2+
terraform-provider-bookstore

example/bookstore/v1/bookstore.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# normally this would be suffixed with the domain (.com)
22
name: "bookstore.example.com"
33
url: "http://localhost:8081"
4+
contact:
5+
name: "API support"
6+
email: "aepsupport@aep.dev"
47
resources:
58
# example of a simple resource
69
- kind: "publisher"

example/bookstore/v1/bookstore_openapi.json

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
{
2+
"info": {
3+
"title": "bookstore.example.com",
4+
"description": "An API for bookstore.example.com",
5+
"version": "version not set",
6+
"contact": {
7+
"name": "API support",
8+
"email": "aepsupport@aep.dev"
9+
}
10+
},
211
"openapi": "3.1.0",
312
"servers": [
413
{
514
"url": "http://localhost:8081"
615
}
716
],
8-
"info": {
9-
"title": "bookstore.example.com",
10-
"description": "An API for bookstore.example.com",
11-
"version": "version not set"
12-
},
1317
"paths": {
1418
"/isbns": {
1519
"get": {
@@ -55,6 +59,15 @@
5559
"post": {
5660
"description": "Create method for isbn",
5761
"operationId": "CreateIsbn",
62+
"parameters": [
63+
{
64+
"name": "id",
65+
"in": "query",
66+
"schema": {
67+
"type": "string"
68+
}
69+
}
70+
],
5871
"responses": {
5972
"200": {
6073
"description": "Successful response",
@@ -165,6 +178,15 @@
165178
"post": {
166179
"description": "Create method for publisher",
167180
"operationId": "CreatePublisher",
181+
"parameters": [
182+
{
183+
"name": "id",
184+
"in": "query",
185+
"schema": {
186+
"type": "string"
187+
}
188+
}
189+
],
168190
"responses": {
169191
"200": {
170192
"description": "Successful response",
@@ -233,7 +255,7 @@
233255
"200": {
234256
"description": "Successful response",
235257
"content": {
236-
"application/json": {
258+
"application/merge-patch+json": {
237259
"schema": {
238260
"$ref": "#/components/schemas/publisher"
239261
}
@@ -243,7 +265,7 @@
243265
},
244266
"requestBody": {
245267
"content": {
246-
"application/json": {
268+
"application/merge-patch+json": {
247269
"schema": {
248270
"$ref": "#/components/schemas/publisher"
249271
}
@@ -386,6 +408,13 @@
386408
"schema": {
387409
"type": "string"
388410
}
411+
},
412+
{
413+
"name": "id",
414+
"in": "query",
415+
"schema": {
416+
"type": "string"
417+
}
389418
}
390419
],
391420
"responses": {
@@ -472,7 +501,7 @@
472501
"200": {
473502
"description": "Successful response",
474503
"content": {
475-
"application/json": {
504+
"application/merge-patch+json": {
476505
"schema": {
477506
"$ref": "#/components/schemas/book"
478507
}
@@ -482,7 +511,7 @@
482511
},
483512
"requestBody": {
484513
"content": {
485-
"application/json": {
514+
"application/merge-patch+json": {
486515
"schema": {
487516
"$ref": "#/components/schemas/book"
488517
}
@@ -651,6 +680,13 @@
651680
"schema": {
652681
"type": "string"
653682
}
683+
},
684+
{
685+
"name": "id",
686+
"in": "query",
687+
"schema": {
688+
"type": "string"
689+
}
654690
}
655691
],
656692
"responses": {
@@ -789,7 +825,15 @@
789825
"content": {
790826
"application/json": {
791827
"schema": {
792-
"$ref": "#/components/schemas/book"
828+
"type": "object",
829+
"properties": {
830+
"success": {
831+
"type": "boolean"
832+
}
833+
},
834+
"x-aep-field-numbers": {
835+
"0": "success"
836+
}
793837
}
794838
}
795839
}
@@ -798,7 +842,9 @@
798842
"requestBody": {
799843
"content": {
800844
"application/json": {
801-
"schema": {}
845+
"schema": {
846+
"type": "object"
847+
}
802848
}
803849
},
804850
"required": true

example/bookstore/v1/bookstore_openapi.yaml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ components:
9898
plural: publishers
9999
singular: publisher
100100
info:
101+
contact:
102+
email: aepsupport@aep.dev
103+
name: API support
101104
description: An API for bookstore.example.com
102105
title: bookstore.example.com
103106
version: version not set
@@ -131,6 +134,11 @@ paths:
131134
post:
132135
description: Create method for isbn
133136
operationId: CreateIsbn
137+
parameters:
138+
- in: query
139+
name: id
140+
schema:
141+
type: string
134142
requestBody:
135143
content:
136144
application/json:
@@ -197,6 +205,11 @@ paths:
197205
post:
198206
description: Create method for publisher
199207
operationId: CreatePublisher
208+
parameters:
209+
- in: query
210+
name: id
211+
schema:
212+
type: string
200213
requestBody:
201214
content:
202215
application/json:
@@ -257,14 +270,14 @@ paths:
257270
type: string
258271
requestBody:
259272
content:
260-
application/json:
273+
application/merge-patch+json:
261274
schema:
262275
$ref: '#/components/schemas/publisher'
263276
required: true
264277
responses:
265278
"200":
266279
content:
267-
application/json:
280+
application/merge-patch+json:
268281
schema:
269282
$ref: '#/components/schemas/publisher'
270283
description: Successful response
@@ -333,6 +346,10 @@ paths:
333346
required: true
334347
schema:
335348
type: string
349+
- in: query
350+
name: id
351+
schema:
352+
type: string
336353
requestBody:
337354
content:
338355
application/json:
@@ -408,14 +425,14 @@ paths:
408425
type: string
409426
requestBody:
410427
content:
411-
application/json:
428+
application/merge-patch+json:
412429
schema:
413430
$ref: '#/components/schemas/book'
414431
required: true
415432
responses:
416433
"200":
417434
content:
418-
application/json:
435+
application/merge-patch+json:
419436
schema:
420437
$ref: '#/components/schemas/book'
421438
description: Successful response
@@ -495,6 +512,10 @@ paths:
495512
required: true
496513
schema:
497514
type: string
515+
- in: query
516+
name: id
517+
schema:
518+
type: string
498519
requestBody:
499520
content:
500521
application/json:
@@ -578,14 +599,20 @@ paths:
578599
requestBody:
579600
content:
580601
application/json:
581-
schema: {}
602+
schema:
603+
type: object
582604
required: true
583605
responses:
584606
"200":
585607
content:
586608
application/json:
587609
schema:
588-
$ref: '#/components/schemas/book'
610+
properties:
611+
success:
612+
type: boolean
613+
type: object
614+
x-aep-field-numbers:
615+
"0": success
589616
description: Successful response
590617
servers:
591618
- url: http://localhost:8081

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
2020
github.com/PuerkitoBio/purell v1.1.0 // indirect
2121
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
22-
github.com/aep-dev/aep-lib-go v0.0.0-20250108173750-6d2a3948c035 // indirect
22+
github.com/aep-dev/aep-lib-go v0.0.0-20250121233519-8bc026ce637e // indirect
2323
github.com/aep-dev/terraform-provider-aep v0.0.0-20241112052633-f48d45460768 // indirect
2424
github.com/agext/levenshtein v1.2.2 // indirect
2525
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect

go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ github.com/aep-dev/aep-lib-go v0.0.0-20250106205003-284e8a515296 h1:l9n7phYnixUH
8282
github.com/aep-dev/aep-lib-go v0.0.0-20250106205003-284e8a515296/go.mod h1:M+h1D6T2uIUPelmaEsJbjR6JhqKsTlPX3lxp25zQQsk=
8383
github.com/aep-dev/aep-lib-go v0.0.0-20250108173750-6d2a3948c035 h1:xezDLZiowdMu7Y/snQJtvR0bNKHwri77S0CEwkzNixA=
8484
github.com/aep-dev/aep-lib-go v0.0.0-20250108173750-6d2a3948c035/go.mod h1:M+h1D6T2uIUPelmaEsJbjR6JhqKsTlPX3lxp25zQQsk=
85+
github.com/aep-dev/aep-lib-go v0.0.0-20250120053507-bea8f15d57e0 h1:3muNvfQJC7CCsWrHDbj94pOReplNHSErGeFKa4vs1q0=
86+
github.com/aep-dev/aep-lib-go v0.0.0-20250120053507-bea8f15d57e0/go.mod h1:M+h1D6T2uIUPelmaEsJbjR6JhqKsTlPX3lxp25zQQsk=
87+
github.com/aep-dev/aep-lib-go v0.0.0-20250120055437-d86b75293789 h1:8l3Gs5q+GiCbLk9R8HH1qXHLszCeDKVFm5PKKzDTBOk=
88+
github.com/aep-dev/aep-lib-go v0.0.0-20250120055437-d86b75293789/go.mod h1:M+h1D6T2uIUPelmaEsJbjR6JhqKsTlPX3lxp25zQQsk=
89+
github.com/aep-dev/aep-lib-go v0.0.0-20250121231840-c83409ea8188 h1:WaJIpprOrdfgJNCJfE6Y5c747H6B+obGIm36epwhjGE=
90+
github.com/aep-dev/aep-lib-go v0.0.0-20250121231840-c83409ea8188/go.mod h1:M+h1D6T2uIUPelmaEsJbjR6JhqKsTlPX3lxp25zQQsk=
91+
github.com/aep-dev/aep-lib-go v0.0.0-20250121232515-a2a291f11702 h1:MgtMJpM68Ht3NrtghsLJ9iwazg74nOmVaZVpkI2X5nA=
92+
github.com/aep-dev/aep-lib-go v0.0.0-20250121232515-a2a291f11702/go.mod h1:M+h1D6T2uIUPelmaEsJbjR6JhqKsTlPX3lxp25zQQsk=
93+
github.com/aep-dev/aep-lib-go v0.0.0-20250121233519-8bc026ce637e h1:fwCEENQV0LVH/HEkn6Egznu9FzsifNwnIW7qoYvs5jw=
94+
github.com/aep-dev/aep-lib-go v0.0.0-20250121233519-8bc026ce637e/go.mod h1:M+h1D6T2uIUPelmaEsJbjR6JhqKsTlPX3lxp25zQQsk=
8595
github.com/aep-dev/terraform-provider-aep v0.0.0-20241112052633-f48d45460768 h1:b5fRfpIIsOsdsT2N1MsBxr0K/fZacCUlWp0uY9/BJzM=
8696
github.com/aep-dev/terraform-provider-aep v0.0.0-20241112052633-f48d45460768/go.mod h1:sUuUJSkWTc4GBxp8GEZXCeEI38VMyuM5msPQ9BG0kMA=
8797
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=

parser/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ func ToAPI(s *schema.Service) (*api.API, error) {
3232
}
3333
return &api.API{
3434
ServerURL: s.Url,
35+
Contact: &api.Contact{
36+
Name: s.Contact.Name,
37+
Email: s.Contact.Email,
38+
},
3539
Name: s.Name,
3640
Schemas: schemas,
3741
Resources: resources,

0 commit comments

Comments
 (0)