Skip to content

Commit acc062d

Browse files
committed
fix: using 'results' in list response
aep.dev/list specifies the returned elements should be in "results".
1 parent 5ca793b commit acc062d

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

internal/service/service_definition.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ func GetServiceDefinition(api *openapi.OpenAPI, pathPrefix string) (*ServiceDefi
6666
if resp.Schema == nil {
6767
slog.Warn(fmt.Sprintf("resource %q has a LIST method with a response schema, but the response is not an object.", path))
6868
} else {
69-
if itemsSchema, ok := resp.Schema.Properties["items"]; ok {
70-
if itemsSchema.Type == "array" {
71-
sRef = itemsSchema.Items
69+
if resultsSchema, ok := resp.Schema.Properties["results"]; ok {
70+
if resultsSchema.Type == "array" {
71+
sRef = resultsSchema.Items
7272
r.ListMethod = &ListMethod{}
7373
} else {
7474
slog.Warn(fmt.Sprintf("resource %q has a LIST method with a response schema, but the items field is not an array.", path))

internal/service/service_definition_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestGetServiceDefinition2(t *testing.T) {
2525
"200": {
2626
Schema: &openapi.Schema{
2727
Properties: map[string]openapi.Schema{
28-
"items": {
28+
"results": {
2929
Type: "array",
3030
Items: &openapi.Schema{
3131
Ref: "#/components/schemas/Widget",

0 commit comments

Comments
 (0)