starlight-openapi
starlight-openapi copied to clipboard
JavaScript heap out of memory
Describe the bug
When trying to navigate to most of my generated swagger, it fails on the 3rd generated endpoint on the build.
This is both when trying to navigate to some pages on the working app, or by just running npm run build
Below is the snippet of Swagger's OpenAPI 3.0.1 fo rthe last seen endpoint that I believe is what broke it, and the next endpoint.
"/api/v1/chatbot/profiles/{profileId}/providers/{providerDescription}/bookings/{bookingNumber}": {
"get": {
"tags": [
"ChatBotProfileProviderBookings"
],
"summary": "Retrieves a booking for a provider using Booking Number",
"operationId": "GetChatbotProfileProviderBookingNumber",
"parameters": [
{
"name": "profileId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "providerDescription",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "bookingNumber",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/Booking"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/Booking"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/Booking"
}
}
}
}
}
}
},
"/api/v1/defaultTemperatureRanges": {
"get": {
"tags": [
"DefaultTemperatureRanges"
],
"summary": "Retrieves a list of JAS temperature ranges used when transporting goods",
"operationId": "GetDefaultTemperatureRanges",
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DefaultTemperatureRange"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DefaultTemperatureRange"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DefaultTemperatureRange"
}
}
}
}
}
}
}
}
To Reproduce
- Generate open api with these two open API endpoints
- Run
npm run build - Wait and it'll fail
Expected behavior
It should build and not freeze the webpage or terminal build
How often does this bug happen?
Every time
System Info
No response
Additional Context
This is for a dotnet 5 API using OpenApi 3.0.1 with Microsoft's built-in swagger support
Thanks for your report.
Would you be able to provide a schema reproducing the issue or a minimal version of the schema that reproduces the issue? This is not something that I can reproduce so far.
Hi @HiDeoo thanks for your hard work on this. I am running into a similar issue. So any ideas would be awesome.
Let me know if any other information would assist.
We are using the same dependencies as in your example repo I think
"dependencies": { "@astrojs/starlight": "0.19.0", "astro": "4.4.0", "sharp": "0.33.2", "starlight-openapi": "^0.6.3" },
We are trying with this schema:
openapi: 3.0.0
info:
title: Hiiro API Documentation
version: 1.0.0
servers:
- url: https://dev-api.doc-service.dev.fsco.io/api/v1
description: Production
- url: https://prod-api.doc-service.fsco.io/api/v1
description: Sandbox
paths:
/command/tag:
post:
summary: Create a new tag
tags:
- Tag
description: Creates a new tag based on the provided details.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateTagBody"
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/TagResponse"
"401":
description: Unauthorized
"400":
description: Bad Request
/command/prompt/test:
post:
summary: Test a prompt
tags:
- Prompts
description: Tests a prompt based on the provided details.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/TestPromptBody"
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/TestPromptResponse"
"401":
description: Unauthorized
"400":
description: Bad Request
/command/prompt/disassociate/templates:
post:
summary: Disassociate a prompt from a template
tags:
- Prompts
description: Disassociates a prompt from the specified template.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/DisassociatePromptFromTemplateBody"
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/DisassociatePromptFromTemplateResponse"
"401":
description: Unauthorized
"400":
description: Bad Request
/command/prompt/associate/templates:
post:
summary: Associate prompts to a template
tags:
- Prompts
description: Associates prompts to a specified template.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/AssociatePromptsToTemplateBody"
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/AssociatePromptsToTemplateResponse"
"401":
description: Unauthorized
"400":
description: Bad Request
/command/prompt/{id}:
put:
summary: Update an existing prompt
tags:
- Prompts
description: Updates an existing prompt based on the provided ID and details.
parameters:
- name: id
in: path
required: true
description: The ID of the prompt to update.
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UpdatePromptBody"
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/PromptResponse"
"401":
description: Unauthorized
"400":
description: Bad Request
/command/prompt:
post:
summary: Create a new prompt
tags:
- Prompts
description: Creates a new prompt based on the provided details.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreatePromptBody"
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/PromptResponse"
"401":
description: Unauthorized
"400":
description: Bad Request
/query/document/{id}:
get:
summary: Retrieves documents by aggregation ID
tags:
- Document
description: Retrieves documents based on the provided aggregation ID.
parameters:
- name: id
in: path
required: true
description: The aggregation ID.
schema:
type: string
- name: aggId
in: query
required: false
description: The aggregation ID. Optional if provided in the query body.
schema:
type: string
- name: uploadUrl
in: query
required: false
description: Flag to indicate if upload URL should be included.
schema:
type: boolean
- name: downloadUrl
in: query
required: false
description: Flag to indicate if download URL should be included.
schema:
type: boolean
- name: fields
in: query
required: false
description: Comma-separated list of fields to include in the response.
schema:
type: string
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/DocumentQueryResponse"
"401":
description: Unauthorized
"400":
description: Bad Request
/query/document/llm:
post:
summary: Get documents by Llm
tags:
- Document
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/GetDocumentByLlmRequest"
responses:
"200":
description: Success response
/query/document:
get:
summary: Retrieve list of documents
tags:
- Document
parameters:
- in: query
name: uploadBatchId
schema:
type: string
description: ID of the upload batch
- in: query
name: groupId
schema:
type: string
description: ID of the document group
# Add other query parameters here
responses:
"200":
description: Success response
content:
application/json:
schema:
$ref: "#/components/schemas/DocumentQueryResponse"
/command/document:
post:
summary: Create a document
tags:
- Document
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
refId:
type: string
docExt:
type: string
docName:
type: string
docType:
type: string
uploadBatchId:
type: string
isPublic:
type: boolean
source:
type: string
templateId:
type: string
nullable: true
groupId:
type: string
nullable: true
prompts:
$ref: "#/components/schemas/PromptCreation"
webhookId:
type: string
nullable: true
bulkDocumentId:
type: string
nullable: true
responses:
"200":
description: Success response
content:
application/json:
schema:
$ref: "#/components/schemas/SingleDocumentCreateResponse"
/command/bulk:
post:
summary: Create bulk document
tags:
- Bulk
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateBulkDocumentRequest"
responses:
"200":
description: Success response
content:
application/json:
schema:
$ref: "#/components/schemas/BatchDocumentCreateResponse"
/command/document/{aggId}/data/{id}:
put:
summary: Update and verify single data
tags:
- Document
parameters:
- in: path
name: aggId
required: true
schema:
type: string
description: The aggregation ID
- in: path
name: id
required: true
schema:
type: string
description: The ID
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
aggId:
type: string
minLength: 1
maxLength: 100
id:
type: string
minLength: 1
maxLength: 100
value: {}
required:
- aggId
- id
responses:
"200":
description: Success response
content:
application/json:
schema:
$ref: "#/components/schemas/DocumentDataFieldResponse"
/command/document/{aggId}/data:
put:
summary: Update and verify multiple data
tags:
- Document
parameters:
- in: path
name: aggId
required: true
schema:
type: string
description: The aggregation ID
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
aggId:
type: string
minLength: 1
maxLength: 100
data:
type: array
items:
type: object
properties:
id:
type: string
minLength: 1
maxLength: 100
value: {}
required:
- id
- value
required:
- aggId
- data
responses:
"200":
description: Success response
content:
application/json:
schema:
$ref: "#/components/schemas/DocumentDataFieldMultipleResponse"
/command/document/{aggId}:
post:
summary: Delete document
tags:
- Document
parameters:
- in: path
name: aggId
required: true
schema:
type: string
description: The aggregation ID
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
aggId:
type: string
minLength: 1
responses:
"200":
description: Success response
content:
application/json:
schema:
type: object
properties:
status:
type: number
components:
schemas:
PromptCreationArray:
type: array
items:
type: object
properties:
name:
type: string
description:
type: string
format:
type: string
field_type:
type: string
nullable: true
item_type:
type: string
nullable: true
children:
$ref: "#/components/schemas/PromptCreationArray"
nullable: true
PromptCreationIDs:
type: array
items:
type: string
nullable: true
PromptCreation:
oneOf:
- $ref: "#/components/schemas/PromptCreationArray"
- $ref: "#/components/schemas/PromptCreationIDs"
nullable: true
SingleDocumentCreateResponse:
type: object
properties:
aggId:
type: string
refId:
type: string
uploadBatchId:
type: string
batchId:
type: string
format: uuid
nullable: true
docName:
type: string
docExt:
type: string
docType:
type: string
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
webhookId:
type: string
nullable: true
status:
type: string
meta:
type: object
properties:
docDownloadUrl:
type: string
nullable: true
docUploadUrl:
type: string
nullable: true
nullable: true
ocrData:
type: object
groups:
type: array
items:
$ref: "#/components/schemas/DocumentGroup"
nullable: true
template:
$ref: "#/components/schemas/DocumentQueryTemplateResponse"
nullable: true
prompts:
type: array
items:
$ref: "#/components/schemas/DocumentQueryPromptsResponse"
nullable: true
DocumentQueryTemplateResponse:
type: object
properties:
id:
type: string
cid:
type: string
type:
type: string
minLength: 1
maxLength: 100
name:
type: string
minLength: 1
maxLength: 100
tag:
type: string
minLength: 1
maxLength: 100
description:
type: string
version:
type: number
DocumentGroup:
type: object
properties:
id:
type: string
name:
type: string
description:
type: string
nullable: true
type:
type: object
properties:
id:
type: string
nullable: true
name:
type: string
nullable: true
status:
type: string
priority:
type: string
nullable: true
tags:
type: array
items:
$ref: "#/components/schemas/Tag"
nullable: true
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
Tag:
type: object
properties:
id:
type: string
name:
type: string
description:
type: string
nullable: true
color:
type: string
nullable: true
organisationId:
type: string
nullable: true
status:
type: string
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
DocumentQueryPromptsResponse:
type: object
properties:
id:
type: string
name:
type: string
description:
type: string
format:
type: string
field_type:
type: string
item_type:
type: string
nullable: true
DocumentDataFieldResponse:
type: object
properties:
id:
type: string
documentId:
type: string
key:
type: string
value:
type: object # Modify this if the value type can be more specific
valueHash:
type: string
DocumentDataFieldMultipleResponse:
type: object
properties:
documentId:
type: string
data:
type: array
items:
type: object
properties:
id:
type: string
key:
type: string
value: {}
valueHash:
type: string
DeleteDocumentResponse:
type: object
properties:
status:
type: number
CreateBulkDocumentRequest:
type: object
properties:
docType:
type: string
minLength: 1
maxLength: 100
uploadBatchId:
type: string
minLength: 1
maxLength: 100
isPublic:
type: boolean
templateId:
type: string
source:
type: string
minLength: 3
maxLength: 100
prompts:
$ref: "#/components/schemas/PromptCreation"
webhookId:
type: string
required:
- docType
- uploadBatchId
- source
BatchDocumentCreateResponse:
type: object
properties:
meta:
type: object
properties:
docUploadUrl:
type: string
id:
type: string
uploadBatchId:
type: string
DocumentQueryResponse:
type: object
properties:
aggId:
type: string
uploadBatchId:
type: string
batchId:
type: string
format: uuid
nullable: true
refId:
type: string
docName:
type: string
docExt:
type: string
docType:
type: string
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
source:
type: string
organisationId:
type: string
nullable: true
isPublic:
type: boolean
isUploaded:
type: boolean
webhookId:
type: string
nullable: true
status:
type: string
meta:
type: object
properties:
docDownloadUrl:
type: string
nullable: true
docUploadUrl:
type: string
nullable: true
nullable: true
ocrData:
type: object
groups:
type: array
items:
$ref: "#/components/schemas/DocumentGroup"
nullable: true
template:
$ref: "#/components/schemas/DocumentQueryTemplateResponse"
nullable: true
prompts:
type: array
items:
$ref: "#/components/schemas/DocumentQueryPromptsResponse"
nullable: true
GetDocumentByLlmRequest:
type: object
properties:
skip:
type: number
take:
type: number
where:
$ref: "#/components/schemas/LlmEntityWhereQuery"
relations:
type: array
items:
type: string
LlmEntityWhereQuery:
type: object
properties:
organisationId:
type: string
nullable: true
value:
type: object # Modify this if the value type can be more specific
nullable: true
json_path:
type: string
nullable: true
documentId:
type: string
nullable: true
getDocumentByAgg:
type: object
properties:
aggId:
type: string
nullable: true
uploadUrl:
type: boolean
nullable: true
default: false
downloadUrl:
type: boolean
nullable: true
default: false
fields:
type: string
nullable: true
CreatePromptBody:
type: object
properties:
name:
type: string
field_type:
type: string
item_type:
type: string
nullable: true
format:
type: string
description:
type: string
parentId:
type: string
minLength: 1
maxLength: 100
nullable: true
template:
type: string
nullable: true
children:
$ref: "#/components/schemas/PromptCreation"
required:
- name
- field_type
- format
- description
- children
PromptResponse:
type: object
properties:
id:
type: string
name:
type: string
field_type:
type: string
item_type:
type: string
nullable: true
description:
type: string
status:
type: string
children:
type: array
items:
oneOf:
- $ref: "#/components/schemas/PromptZod"
- $ref: "#/components/schemas/EmptyObjectSchema"
nullable: true
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
PromptZod:
type: object
properties:
id:
type: string
name:
type: string
field_type:
type: string
item_type:
type: string
nullable: true
format:
type: string
nullable: true
description:
type: string
nullable: true
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
children:
type: array
items:
$ref: "#/components/schemas/PromptZod"
nullable: true
EmptyObjectSchema:
type: object
additionalProperties: false
UpdatePromptBody:
type: object
properties:
id:
type: string
parentId:
type: string
minLength: 1
maxLength: 100
required:
- id
- parentId
DeletePromptResponse:
type: object
properties:
status:
type: number
DeletePromptBody:
type: object
properties:
id:
type: string
nullable: true
AssociatePromptsToTemplateBody:
type: object
properties:
templateId:
type: string
prompts:
$ref: "#/components/schemas/PromptCreation"
required:
- templateId
- prompts
AssociatePromptsToTemplateResponse:
type: object
properties:
status:
type: number
DisassociatePromptFromTemplateResponse:
type: object
properties:
status:
type: number
DisassociatePromptFromTemplateBody:
type: object
properties:
templateId:
type: string
promptId:
type: string
required:
- templateId
- promptId
TestPromptBody:
type: object
properties:
requestId:
type: string
nullable: true
documentId:
type: string
documentType:
type: string
prompts:
type: array
items:
$ref: "#/components/schemas/PromptCreation"
nullable: true
required:
- documentId
- documentType
TestPromptResponse:
type: object
properties:
ocrData:
type: object
nullable: true
prompts:
type: array
items:
$ref: "#/components/schemas/PromptTestResponse"
nullable: true
requestId:
type: string
nullable: true
message:
type: string
nullable: true
PromptTestResponse:
type: object
properties:
name:
type: string
field_type:
type: string
item_type:
type: string
nullable: true
description:
type: string
nullable: true
format:
type: string
nullable: true
children:
type: array
items:
oneOf:
- $ref: "#/components/schemas/PromptZod"
- $ref: "#/components/schemas/EmptyObjectSchema"
nullable: true
CreateTagBody:
type: object
properties:
name:
type: string
description:
type: string
nullable: true
color:
type: string
nullable: true
status:
type: string
default: "active"
nullable: true
groupId:
type: string
nullable: true
required:
- name
TagResponse:
type: object
properties:
id:
type: string
name:
type: string
description:
type: string
nullable: true
color:
type: string
nullable: true
status:
type: string
groupId:
type: string
nullable: true
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
I have tried the same config setup but with the animals.yaml and it works fine so I am going to try and pinpoint where it differs.
It seems like the issue either lines in the oneOf or the children as I got it to build when those were both removed.
I was running into the same issue, mine was due to having a circular reference in the component.