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.

Export for non existent path and type

See original GitHub issue

Describe the bug I’ve tried to generate types and clients for the Klarna APIs. For the Checkout API and Payments API it works great, but with the Order Management API it generates an export for a type that does not match the generated type name (image). It also generates an additional export for a type in a file that doe not exist. Not sure if this is something wrong in Klarna’s OpenAPI spec (available on url above) or if this can be corrected with the code generator.

In the screenshot I have skipped generating core, services and client for simplicity. My config is:

{
	input: path,
	output: path,
	exportCore: false,
	exportServices: false,
	indent: 'tab',
	httpClient: 'axios'
}

image image

Summary

  • type address is generated and put into Address.ts
  • address.ts is not generated but exported from index.ts
  • type Address is not generated but exported from Address.ts in index.ts

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ajenkins-cargometricscommented, May 16, 2022

Yes, can confirm I’m on Mac

In that case, a fairly easy workaround is to have the tool initially write the files to a case-sensitive filesystem, and then fix up the filenames so they’re unique ignoring case. Here’s how you could do that on a Mac.

  1. Get a spare external drive, like a flash drive. Open Disk Utility, select the main partition on your external drive, select Erase, and choose the “Mac OS Extended (Case-sensitive)” format. Click Erase.
  2. Now run the openapi generator, telling it to write the files to the external drive. Since it’s a case-sensitive filesystem, it should work. You’ll have separate “Address.ts” and “address.ts” files.
  3. On the external drive, rename address.ts (lower-case) to something like address2.ts. Edit index.ts to change the import for “address” to import from “./models/address2”. Make a similar change to the schema file if you’re using schema files.
  4. Repeat the previous step for any other files whose names differ only by case. I didn’t check if there are any others.
  5. Now you can safely copy the files to your main drive.

If you have access to a Linux machine, you could also use that since they have case-sensitive filesystems by default.

1reaction
ferdikoomencommented, May 31, 2022

@marjorg, @ajenkins-cargometrics is correct, the spec contains two models, only differencing in case. The best way is to have a case-sensitive file system. There is sadly no way to enforce case-sensitivity in NodeJS when writing these files 😦 @ajenkins-cargometrics thanks for the response! Much appreciated!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Export non-existent file paths to text file from Powershell
Trying to locate existent OR non-existent directories via powershell and a CSV file with the supposed directories. We can get it to run...
Read more >
Misleading error message when trying to Export all to non ...
It uses the directory path you provide in export window. The problem is, if the path points to non-existent directory, instead of telling...
Read more >
directory - Is there a problem if I add a non-existing path to ...
I think I found it somewhere in the internet. Is it also ok, if I write only PATH="$HOME/bin:$PATH" without checking directory existence? Does ......
Read more >
(EmberGen) Image Export saves to unknown location when ...
Whenever EmberGen encounters non existent file path, it still saves the file but I have no clue where, definitely not in the specified ......
Read more >
OSError: Cannot save file into a non-existent directory
I am using Azure ML Studio to read data from a csv file by creating a data asset test5 and write data into...
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