PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs
They are probably incompatible. Values: "integer" "string"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 315
- Avg merge
- 7d 5h
- Merged PRs (30d)
- 7
Description
Describe the bug
Can't generate the api docs sucessfully due to a compatibility validation error with the following behaviour:
I'm using allOf, have an object with an array of items. This items have a property as integer and I want to override each item by another custom object that also have the same property but as a string.
Expected behavior
No errors.
Current behavior
Get the following error:
[ERROR] Error: Could not resolve values for path:"properties.errors.items.properties.code.type". They are probably incompatible. Values: "integer" "string" at throwIncompatible (...\node_modules\json-schema-merge-allof\src\index.js:95:9) at ...\node_modules\json-schema-merge-allof\src\index.js:320:11 at Array.forEach () at mergeSchemas (...\node_modules\json-schema-merge-allof\src\index.js:301:13) at properties (...\node_modules\json-schema-merge-allof\src\index.js:116:42) at ...\node_modules\json-schema-merge-allof\src\complex-resolvers\properties.js:27:16 at Array.reduce () at mergeSchemaGroup (...\node_modules\json-schema-merge-allof\src\complex-resolvers\properties.js:24:18) at Object.resolver (...\node_modules\json-schema-merge-allof\src\complex-resolvers\properties.js:71:19) at callGroupResolver (...\node_modules\json-schema-merge-allof\src\index.js:119:35) [INFO] Docusaurus version: 3.4.0
Possible solution
The compatibility validation is no needed in this case as you try to replace the whole schema by other. The types could not match at all and this could be intentionally the objective of the substitution.
Steps to reproduce
yarn docusaurus gen-api-docs all
with the following piece of openapi:
CustomErrorResponse:
allOf:
- $ref: '#/components/schemas/ErrorResponse'
- type: object
properties:
payload:
allOf:
- $ref: '#/components/schemas/ErrorResponsePayload'
- type: object
properties:
data:
allOf:
- $ref: '#/components/schemas/ErrorResponseData'
- type: object
properties:
errors:
type: array
description: List of errors
items:
$ref: '#/components/schemas/CustomError'
ErrorResponse:
type: object
properties:
payload:
$ref: '#/components/schemas/ErrorResponsePayload'
status:
$ref: '#/components/schemas/ResponseStatus'
ErrorResponsePayload:
type: object
properties:
data:
$ref: '#/components/schemas/ErrorResponseData'
description: Error response payload
ErrorResponseData:
type: object
properties:
errors:
type: array
description: List of errors
items:
$ref: '#/components/schemas/Error'
description: Error response data
Error:
type: object
properties:
code:
type: integer
description: Internal error code
example: '500'
message:
type: string
description: Main error message.
example: 'INTERNAL_SERVER_ERROR'
details:
type: string
description: Contains additional details of the error.
example: 'A system error has occurred, please forgive the inconvenience.'
description: Error detail
CustomError:
type: object
required:
- code
properties:
code:
type: string
enum:
- ERROR_1
- ERROR_2
example: ERROR_1
where Error schema has 'code' as integer and CustomError has 'code' as string (enum).
Context
I could visualize a swagger preview with other tools without any issue so I discard openapi codification error.
Your Environment
- Version used: Docusaurus version 3.4.0 and also tested in 3.5.2
- Environment name and version: node v20.15.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run yarn docusaurus gen-api-docs all with the Error/CustomError OpenAPI example, then trace the reported json-schema-merge-allof/src/index.js merge path and its complex-resolvers/properties.js calls. Done means API documentation generation succeeds for the example without the incompatible integer/string error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, openapi, typescript
- Domain
- api, documentation, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100