AsOf schema names
See original GitHub issueWhat are the steps to reproduce this issue?
Generate client using spec:
openapi: '3.0.0'
info:
version: 1.0.0
title: Test
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/colors:
get:
summary: List colors
operationId: listColors
tags:
- colors
responses:
'200':
description: An array of colors
content:
application/json:
schema:
$ref: '#/components/schemas/Color'
components:
schemas:
ColorType:
type: string
enum:
- red
- green
- blue
Color:
type: object
required:
- color
properties:
type:
allOf:
- $ref: '#/components/schemas/ColorType'
What happens?
The result is:
export type ColorType = 'red' | 'green' | 'blue';
export const ColorType = {
red: 'red' as ColorType,
green: 'green' as ColorType,
blue: 'blue' as ColorType,
};
export type ColorType = ColorType
export const ColorType = {...ColorType};
export interface Color {
type?: ColorType;
}
The second type-const pair uses the same name as the first pair, resulting in Cannot redeclare block-scoped variable 'ColorType'.ts (2451)
What were you expecting to happen?
Some other name of the second type. Maybe keep ColorTypeAllOf
?
Any other comments?
I traced the issue to here: https://github.com/anymaniax/orval/blob/master/src/core/resolvers/value.ts#L22
And noticed that the name
parameter to resolveValue
is ColorTypeAllOf
, but the returned name
from resolveRef
is ColorType
.
What versions are you using?
49290694a8e072ee4f7311c0a04ee92da9cfef35
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Names | Databricks on AWS
In this article: Catalog name; Schema name; Database name; Table name; View name; Column name; Field name; Function name; Parameter name; Table ...
Read more >Reserved schema names and reserved words - IBM
It is strongly recommended that schema names never begin with the 'SYS' prefix, because 'SYS', by convention, is used to indicate an area...
Read more >What Is a Schema in SQL and Advantages of Using Schema
In a SQL database, a schema is a list of logical structures of data. A database user owns the schema, which has the...
Read more >How do I list all tables in a schema in Oracle SQL?
To see all tables in another schema, you need to have one or more of the following system privileges: SELECT ANY DICTIONARY (SELECT...
Read more >CREATE SCHEMA | CockroachDB Docs
The CREATE SCHEMA statement creates a new user-defined schema. ... The schema name must be unique within its database and follow these identifier...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@anymaniax is this up-for-grabs?
Closing this issue since it’s normally fixed. Don’t hesitate if you have any problem