Skip to content

Commit

Permalink
Feature/847 openapi codegen limitations (#861)
Browse files Browse the repository at this point in the history
* fix for oapi-generator inplace response schema problems *200 and []200.  Need to use docs/openapi.yaml

* Fix readOnly in model.saved-queries-permissions.yaml.

* Previous fix to api.response.data-quality-platform-aggregate is now backwards compatible.

* regenerated doc/openapi.json to include fixes to src spec.

* x-go-name for deprecated parameters to avoid name collision in generated go code.  Also finding which is not deprecated
  • Loading branch information
daviditkin authored Sep 23, 2024
1 parent 98d39e5 commit 4d81712
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 80 deletions.
123 changes: 68 additions & 55 deletions packages/go/openapi/doc/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,19 +205,7 @@
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"oneOf": [
{
"$ref": "#/components/schemas/model.user"
},
{
"$ref": "#/components/schemas/model.client"
}
]
}
}
"$ref": "#/components/schemas/api.response.authenticated-requester"
}
}
}
Expand Down Expand Up @@ -9373,32 +9361,7 @@
"content": {
"application/json": {
"schema": {
"allOf": [
{
"$ref": "#/components/schemas/api.response.pagination"
},
{
"$ref": "#/components/schemas/api.response.time-window"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/model.ad-data-quality-aggregation"
},
{
"$ref": "#/components/schemas/model.azure-data-quality-aggregation"
}
]
}
}
}
}
]
"$ref": "#/components/schemas/api.response.data-quality-platform-aggregate"
}
}
}
Expand Down Expand Up @@ -12211,6 +12174,7 @@
"parameters": [
{
"name": "finding",
"x-go-name": "FindingDeprecated",
"in": "query",
"schema": {
"$ref": "#/components/schemas/api.params.predicate.filter.string"
Expand All @@ -12227,6 +12191,7 @@
{
"name": "FromPrincipal",
"deprecated": true,
"x-go-name": "FromPrincipalDeprecated",
"in": "query",
"schema": {
"$ref": "#/components/schemas/api.params.predicate.filter.string"
Expand All @@ -12235,6 +12200,7 @@
{
"name": "ToPrincipal",
"deprecated": true,
"x-go-name": "ToPrincipalDeprecated",
"in": "query",
"schema": {
"$ref": "#/components/schemas/api.params.predicate.filter.string"
Expand Down Expand Up @@ -12271,6 +12237,7 @@
{
"name": "AcceptedUntil",
"deprecated": true,
"x-go-name": "AcceptedUntilDeprecated",
"in": "query",
"schema": {
"$ref": "#/components/schemas/api.params.predicate.filter.time"
Expand Down Expand Up @@ -12574,19 +12541,7 @@
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"oneOf": [
{
"$ref": "#/components/schemas/model.list-finding"
},
{
"$ref": "#/components/schemas/model.relationship-finding"
}
]
}
}
"$ref": "#/components/schemas/api.response.finding"
}
}
}
Expand Down Expand Up @@ -12638,6 +12593,7 @@
{
"name": "from",
"deprecated": true,
"x-go-name": "fromDeprecated",
"description": "Lower bound for created_at; to return posture stats starting at a specific date/time",
"in": "query",
"schema": {
Expand All @@ -12648,6 +12604,7 @@
{
"name": "to",
"deprecated": true,
"x-go-name": "toDeprecated",
"description": "Upper bound for created_at; to return posture stats upto a specific date/time",
"in": "query",
"schema": {
Expand Down Expand Up @@ -13817,6 +13774,21 @@
}
]
},
"api.response.authenticated-requester": {
"type": "object",
"properties": {
"data": {
"oneOf": [
{
"$ref": "#/components/schemas/model.user"
},
{
"$ref": "#/components/schemas/model.client"
}
]
}
}
},
"model.saml-provider": {
"allOf": [
{
Expand Down Expand Up @@ -14786,12 +14758,10 @@
"type": "object",
"properties": {
"shared_to_user_id": {
"readOnly": true,
"allOf": [
{
"$ref": "#/components/schemas/null.uuid"
},
{
"readOnly": true
}
]
},
Expand Down Expand Up @@ -15076,6 +15046,34 @@
}
]
},
"api.response.data-quality-platform-aggregate": {
"allOf": [
{
"$ref": "#/components/schemas/api.response.pagination"
},
{
"$ref": "#/components/schemas/api.response.time-window"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/model.ad-data-quality-aggregation"
},
{
"$ref": "#/components/schemas/model.azure-data-quality-aggregation"
}
]
}
}
}
}
]
},
"enum.datapipe-status": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -15477,6 +15475,21 @@
}
]
},
"api.response.finding": {
"type": "object",
"properties": {
"data": {
"oneOf": [
{
"$ref": "#/components/schemas/model.list-finding"
},
{
"$ref": "#/components/schemas/model.relationship-finding"
}
]
}
}
},
"model.risk-posture-stat": {
"allOf": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,7 @@ put:
content:
application/json:
schema:
type: object
properties:
data:
oneOf:
- $ref: './../schemas/model.list-finding.yaml'
- $ref: './../schemas/model.relationship-finding.yaml'
$ref: './../schemas/api.response.finding.yaml'
400:
$ref: './../responses/bad-request.yaml'
401:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ get:
- Enterprise
parameters:
- name: finding
x-go-name: "FindingDeprecated"
in: query
schema:
$ref: './../schemas/api.params.predicate.filter.string.yaml'
Expand All @@ -44,11 +45,13 @@ get:
$ref: './../schemas/api.params.query.sort-by.yaml'
- name: FromPrincipal
deprecated: true
x-go-name: "FromPrincipalDeprecated"
in: query
schema:
$ref: './../schemas/api.params.predicate.filter.string.yaml'
- name: ToPrincipal
deprecated: true
x-go-name: "ToPrincipalDeprecated"
in: query
schema:
$ref: './../schemas/api.params.predicate.filter.string.yaml'
Expand All @@ -70,6 +73,7 @@ get:
$ref: './../schemas/api.params.predicate.filter.string.yaml'
- name: AcceptedUntil
deprecated: true
x-go-name: "AcceptedUntilDeprecated"
in: query
schema:
$ref: './../schemas/api.params.predicate.filter.time.yaml'
Expand Down
7 changes: 1 addition & 6 deletions packages/go/openapi/src/paths/auth.self.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ get:
content:
application/json:
schema:
type: object
properties:
data:
oneOf:
- $ref: './../schemas/model.user.yaml'
- $ref: './../schemas/model.client.yaml'
$ref: './../schemas/api.response.authenticated-requester.yaml'
429:
$ref: './../responses/too-many-requests.yaml'
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,7 @@ get:
content:
application/json:
schema:
allOf:
- $ref: './../schemas/api.response.pagination.yaml'
- $ref: './../schemas/api.response.time-window.yaml'
- type: object
properties:
data:
type: array
items:
oneOf:
- $ref: './../schemas/model.ad-data-quality-aggregation.yaml'
- $ref: './../schemas/model.azure-data-quality-aggregation.yaml'
$ref: './../schemas/api.response.data-quality-platform-aggregate.yaml'
400:
$ref: './../responses/bad-request.yaml'
401:
Expand Down
2 changes: 2 additions & 0 deletions packages/go/openapi/src/paths/risk-posture.posture-stats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ get:
$ref: './../schemas/api.params.query.sort-by.yaml'
- name: from
deprecated: true
x-go-name: "fromDeprecated"
description: Lower bound for created_at; to return posture stats starting at
a specific date/time
in: query
Expand All @@ -40,6 +41,7 @@ get:
format: date-time
- name: to
deprecated: true
x-go-name: "toDeprecated"
description: Upper bound for created_at; to return posture stats upto a specific
date/time
in: query
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: object
properties:
data:
oneOf:
- $ref: './../schemas/model.user.yaml'
- $ref: './../schemas/model.client.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
allOf:
- $ref: './../schemas/api.response.pagination.yaml'
- $ref: './../schemas/api.response.time-window.yaml'
- type: object
properties:
data:
type: array
items:
oneOf:
- $ref: './../schemas/model.ad-data-quality-aggregation.yaml'
- $ref: './../schemas/model.azure-data-quality-aggregation.yaml'

6 changes: 6 additions & 0 deletions packages/go/openapi/src/schemas/api.response.finding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: object
properties:
data:
oneOf:
- $ref: './../schemas/model.list-finding.yaml'
- $ref: './../schemas/model.relationship-finding.yaml'
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ allOf:
- type: object
properties:
shared_to_user_id:
readOnly: true
allOf:
- $ref: './null.uuid.yaml'
- readOnly: true
query_id:
type: integer
format: int64
public:
type: boolean
type: boolean

0 comments on commit 4d81712

Please sign in to comment.