Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand snapshot repository types #2255

Merged
merged 13 commits into from
Mar 6, 2024
6 changes: 3 additions & 3 deletions compiler/src/model/build-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@ function compileClassOrInterfaceDeclaration (declaration: ClassDeclaration | Int
const queryType = type.query.find(property => property != null && property.name === part.name) as model.Property
if (!deepEqual(queryType.type, part.type)) {
assert(pathMember as Node, part.codegenName != null, `'${part.name}' already exist in the query_parameters with a different type, you should define an @codegen_name.`)
assert(pathMember as Node, !type.query.map(p => p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in query_parameters.`)
assert(pathMember as Node, !type.query.map(p => p.codegenName || p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in query_parameters.`)
}
}
if (bodyProperties.map(p => p.name).includes(part.name)) {
const bodyType = bodyProperties.find(property => property != null && property.name === part.name) as model.Property
if (!deepEqual(bodyType.type, part.type)) {
assert(pathMember as Node, part.codegenName != null, `'${part.name}' already exist in the body with a different type, you should define an @codegen_name.`)
assert(pathMember as Node, !bodyProperties.map(p => p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in body.`)
assert(pathMember as Node, !bodyProperties.map(p => p.codegenName || p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in body.`)
}
}
}
Expand All @@ -296,7 +296,7 @@ function compileClassOrInterfaceDeclaration (declaration: ClassDeclaration | Int
)
assert(
(bodyMember as PropertySignature).getJsDocs(),
!type.path.map(p => p.name).concat(type.query.map(p => p.name)).includes(tags.codegen_name),
!type.path.map(p => p.codegenName || p.name).concat(type.query.map(p => p.codegenName || p.name)).includes(tags.codegen_name),
`The codegen_name '${tags.codegen_name}' already exists as a property in the path or query.`
)
type.body = {
Expand Down
Loading
Loading