question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: multiple exports with the same name

See original GitHub issue

I my *.yaml file I have a structure like this:

openapi 3.0.3
info: ...
tags: ...
paths: ...
components:
  schemas: 
    MyAnotherType:
      type: object
      description: Some text
      properties:
        details:
          type: array
          description: Some text
          items:
            $ref: '#/components/schemas/MyType'
    MyType:
      type: string
      description: Some text
      example: Some more text

this causes duplicated export type MyType = string in generated *.schema.ts file

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
yekvercommented, Apr 4, 2022

Yeah. Sorry for the incorrect issue description. I’ve figured out that problem can be reproduced this way:

  1. Create 1.yaml file with the some structure
  2. Duplicate this file with another name, lets say 2.yaml
  3. Go to the 1.yaml and add some property reference to the type from 2.yaml ($ref: './2.yaml#/components/schemas/MyType')

As a result all the referenced schemas will be merged and if there are any schemas with the same name the issue will be produced.

0reactions
yekvercommented, May 14, 2022

We don’t know if the duplicate type are different or would need to compare them.

You are right, comparing absolutely to know whether type is duplicated or not. Otherwise some types will be the same but name.

And otherwise using another file + alias import should solve the problem no?

Yeah it will, but how to deal with case when all the generated schemas must be merged into a single file?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple exports with the same name "default" #6692 - GitHub
Describe the bug Following code doesn't work with vite, it's a valid js/ts syntax and it works fine in vue cli Workaround 1:...
Read more >
React js : how to resolve multiple export? - Stack Overflow
1.Named Exports(Zero or more exports per module): This allows you to export multiple modules from a javascript file which is the case in...
Read more >
Resolve the "Export EXPORT_NAME cannot be updated as it ...
You get this error when one or more stacks are importing an exported output value from the stack that you want to update...
Read more >
Export data to Excel - Microsoft Support
Using the Export Wizard, you can export data from an Access database to in a file format that can be read by Excel....
Read more >
Export Multiple - Audacity Manual
This item is off (unchecked) by default. If unchecked, any files to be exported which have the same name as pre-existing files in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found