docs-util: fix OAS generation error (#8577)
This commit is contained in:
@@ -31,6 +31,16 @@ decorators:
|
|||||||
- AdminProduct
|
- AdminProduct
|
||||||
AdminProduct:
|
AdminProduct:
|
||||||
- AdminProduct
|
- AdminProduct
|
||||||
|
AdminStockLocation:
|
||||||
|
- AdminFulfillmentSet
|
||||||
|
OrderChange:
|
||||||
|
- Order
|
||||||
|
StoreShippingOption:
|
||||||
|
- StoreShippingOption
|
||||||
|
AdminServiceZone:
|
||||||
|
- AdminFulfillmentSet
|
||||||
|
OrderTransaction:
|
||||||
|
- Order
|
||||||
|
|
||||||
# Similar config to /www/docs/docusaurus.config.js > redocusaurus
|
# Similar config to /www/docs/docusaurus.config.js > redocusaurus
|
||||||
# Allows to emulate rendering of API public documentation when using `yarn redocly preview-docs openapi.yaml`
|
# Allows to emulate rendering of API public documentation when using `yarn redocly preview-docs openapi.yaml`
|
||||||
|
|||||||
@@ -106,6 +106,23 @@ servers:
|
|||||||
- url: https://api.medusa-commerce.com
|
- url: https://api.medusa-commerce.com
|
||||||
paths: {}
|
paths: {}
|
||||||
components:
|
components:
|
||||||
|
schemas:
|
||||||
|
Error:
|
||||||
|
title: "Response Error"
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: string
|
||||||
|
description: A slug code to indicate the type of the error.
|
||||||
|
enum: [invalid_state_error, invalid_request_error, api_error, unknown_error]
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
description: Description of the error that occurred.
|
||||||
|
example: "first_name must be a string"
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
description: A slug indicating the type of the error.
|
||||||
|
enum: [QueryRunnerAlreadyReleasedError, TransactionAlreadyStartedError, TransactionNotStartedError, conflict, unauthorized, payment_authorization_error, duplicate_error, not_allowed, invalid_data, not_found, database_error, unexpected_state, invalid_argument, unknown_error]
|
||||||
responses:
|
responses:
|
||||||
default_error:
|
default_error:
|
||||||
description: Default Error
|
description: Default Error
|
||||||
@@ -246,4 +263,4 @@ components:
|
|||||||
type: apiKey
|
type: apiKey
|
||||||
in: cookie
|
in: cookie
|
||||||
name: connect.sid
|
name: connect.sid
|
||||||
x-displayName: Cookie Session ID
|
x-displayName: Cookie Session ID
|
||||||
@@ -47,6 +47,23 @@ servers:
|
|||||||
- url: https://api.medusa-commerce.com
|
- url: https://api.medusa-commerce.com
|
||||||
paths: {}
|
paths: {}
|
||||||
components:
|
components:
|
||||||
|
schemas:
|
||||||
|
Error:
|
||||||
|
title: "Response Error"
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: string
|
||||||
|
description: A slug code to indicate the type of the error.
|
||||||
|
enum: [invalid_state_error, invalid_request_error, api_error, unknown_error]
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
description: Description of the error that occurred.
|
||||||
|
example: "first_name must be a string"
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
description: A slug indicating the type of the error.
|
||||||
|
enum: [QueryRunnerAlreadyReleasedError, TransactionAlreadyStartedError, TransactionNotStartedError, conflict, unauthorized, payment_authorization_error, duplicate_error, not_allowed, invalid_data, not_found, database_error, unexpected_state, invalid_argument, unknown_error]
|
||||||
responses:
|
responses:
|
||||||
default_error:
|
default_error:
|
||||||
description: Default Error
|
description: Default Error
|
||||||
|
|||||||
@@ -27,6 +27,22 @@ class SchemaFactory {
|
|||||||
type: "string",
|
type: "string",
|
||||||
format: "date-time",
|
format: "date-time",
|
||||||
},
|
},
|
||||||
|
$and: {
|
||||||
|
type: "array",
|
||||||
|
description:
|
||||||
|
"Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.",
|
||||||
|
items: {
|
||||||
|
type: "object",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
$or: {
|
||||||
|
type: "array",
|
||||||
|
description:
|
||||||
|
"Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.",
|
||||||
|
items: {
|
||||||
|
type: "object",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1653,9 +1653,21 @@ class OasKindGenerator extends FunctionKindGenerator {
|
|||||||
(updatedParameter.schema as OpenApiSchema).type !==
|
(updatedParameter.schema as OpenApiSchema).type !==
|
||||||
(parameter.schema as OpenApiSchema).type
|
(parameter.schema as OpenApiSchema).type
|
||||||
) {
|
) {
|
||||||
;(parameter.schema as OpenApiSchema).type = (
|
// the entire schema should be updated if the type changes.
|
||||||
updatedParameter.schema as OpenApiSchema
|
parameter.schema = updatedParameter.schema
|
||||||
).type
|
} else if ((updatedParameter.schema as OpenApiSchema).type === "array") {
|
||||||
|
;(parameter.schema as OpenAPIV3.ArraySchemaObject).items =
|
||||||
|
this.updateSchema({
|
||||||
|
oldSchema: (parameter.schema as OpenAPIV3.ArraySchemaObject).items,
|
||||||
|
newSchema: (updatedParameter.schema as OpenAPIV3.ArraySchemaObject)
|
||||||
|
.items,
|
||||||
|
}) || (updatedParameter.schema as OpenAPIV3.ArraySchemaObject).items
|
||||||
|
} else if ((updatedParameter.schema as OpenApiSchema).type === "object") {
|
||||||
|
parameter.schema =
|
||||||
|
this.updateSchema({
|
||||||
|
oldSchema: parameter.schema,
|
||||||
|
newSchema: updatedParameter.schema,
|
||||||
|
}) || updatedParameter.schema
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user