Duplicated entry in schema if casing of NamedSchema differ from filename
@kanoru3101 is already working on this.
Since Sep 3, 2026.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 228
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 48
Description
Describe the bug
When creating a schema to validate an API request (Let's call it ApiRequest), if the casing for the NamedSchema is capitalize whereas the filename itself is not, it will result in a duplicate when running it through redocly bundle
To Reproduce
Steps to reproduce the behavior:
.redocly.yaml
extends:
- recommended
plugins:
- src/schemata/plugins/extend-id-and-schema.js
apis:
main@v0:
root: src/schemata/openapi.yaml
labels:
- production
rules:
no-unused-components: warn
# custom rule to ensure $id and $schema is passed
# this is only enabled in external endpoints
assert/required-id-and-schema:
where:
- subject:
type: Operation
property: operationId
assertions:
pattern: ^((?!(smoke|health)).)*$
- subject:
type: Response
filterInParentKeys:
- '200'
assertions:
defined: true
subject:
type: Schema
assertions:
defined: true
required:
- $id
- $schema
message: Must have $id and $schema in Schema properties
severity: error
openapi.yaml
openapi: 3.0.3
info:
# info are hidden
servers:
# servers are hidden
paths:
# paths are hidden
components:
schemas:
ApiRequest:
$ref: ./components/requests/apiRequest.yaml
and my apiRequest.yaml
$schema: http://json-schema.org/draft-07/schema
$id: ApiRequest
type: object
description: Request schema for /api/* endpoints
required:
- jobId
- hirerId
- hirerOriginZone
properties:
jobId:
type: string
description: Represent id of job ad
example: 51563417
hirerId:
type: string
description: Represent id of job ad's hirer
example: 28829855
hirerOriginZone:
type: string
description: Represent origin zone of hirer's location.
example: anz-1
- Run this command
redocly bundle ./src/schemata/openapi.yaml -o ./src/schemata/openapi-generated --ext=json --format=json --dereferenced --lint --skip-rule=spec
- Output
{
"openapi": "3.0.3",
# stripped out info
# stripped out paths
"components": {
"schemas": {
"ApiRequest": {
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "ApiRequest",
"type": "object",
"description": "Request schema for /api/* endpoints",
"required": [
"jobId",
"hirerId",
"hirerOriginZone"
],
"properties": {
"jobId": {
"type": "string",
"description": "Represent id of job ad",
"example": 51563417
},
"hirerId": {
"type": "string",
"description": "Represent id of job ad's hirer",
"example": 28829855
},
"hirerOriginZone": {
"type": "string",
"description": "Represent origin zone of hirer's location.",
"example": "anz-1"
}
}
},
"apiRequest": {
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "ApiRequest",
"type": "object",
"description": "Request schema for /api/* endpoints",
"required": [
"jobId",
"hirerId",
"hirerOriginZone"
],
"properties": {
"jobId": {
"type": "string",
"description": "Represent id of job ad",
"example": 51563417
},
"hirerId": {
"type": "string",
"description": "Represent id of job ad's hirer",
"example": 28829855
},
"hirerOriginZone": {
"type": "string",
"description": "Represent origin zone of hirer's location.",
"example": "anz-1"
}
}
}
}
}
}
Expected behavior
{
"openapi": "3.0.3",
# strip out info
# strip out paths
"components": {
"schemas": {
"ApiRequest": {
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "ApiRequest",
"type": "object",
"description": "Request schema for /api/* endpoints",
"required": [
"jobId",
"hirerId",
"hirerOriginZone"
],
"properties": {
"jobId": {
"type": "string",
"description": "Represent id of job ad",
"example": 51563417
},
"hirerId": {
"type": "string",
"description": "Represent id of job ad's hirer",
"example": 28829855
},
"hirerOriginZone": {
"type": "string",
"description": "Represent origin zone of hirer's location.",
"example": "anz-1"
}
}
}
}
}
}
Logs

OpenAPI definition
OAS 3.0
Redocly Version(s)
1.0.0-beta.112
Node.js Version(s)
v16.17.0
Additional context
tldr; Expecting one output of ApiRequest (following casing of NamedSchema) instead of having 2 where there other is a lowercase (when the filename starts with a lowercase)
Weird behaviour but when I do
$ref: '../components/requests/ApiRequest.yamlit does not throw an error inlintnor the vscode extension
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.
Assessment
This issue has not been assessed yet.