riok / Kreya

Kreya is a GUI client for gRPC and REST APIs with innovative features for environments, authorizations and more.
https://kreya.app
284 stars 5 forks source link

API operations have empty URLs after import from Postman or Insomnia #225

Closed andreassiegel closed 3 months ago

andreassiegel commented 5 months ago

Describe the bug

Whenever I import a project from an existing Postman collection or Insomnia collection, the general structure or hierarchy of requests and folders is imported as expected.

However, the request path is empty for all operations which results in a pointless import.

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'Import…'
  2. Select the existing collection to import
  3. Confirm the import
  4. Open any of the operations in the new Kreya project
  5. Check the request path

Expected behavior

The request path should be taken over from the imported collection.

Ideally, the host should be imported as endpoint in the settings, and the rest of the URL should be the request path.

Screenshots

None.

Environment:

Additional context

The issue occurs regardless of whether I try to import Insomnia or Postman collections of the same original project.

I can only get the desired result if I basically start from scratch and configure OpenAPI importers.

CommonGuy commented 5 months ago

After importing, is the full request path added to the endpoint (open a Kreya operation, click the Settings tab, check the Endpoint field)?

If so, Kreya may not recognize the "format" (e.g. due to templating) and is not able to separate the host from the rest of the request path

Could you add an example of your path format?

andreassiegel commented 5 months ago

After importing, is the full request path added to the endpoint (open a Kreya operation, click the Settings tab, check the Endpoint field)?

No, it is completely empty:

image image image

If so, Kreya may not recognize the "format" (e.g. due to templating) and is not able to separate the host from the rest of the request path

Could you add an example of your path format?

This is a good hint! Thank you!

I found one directory where at least the paths of the operations were set (but also no host in the endpoint settings). In this case, the URL in the collection was something like https://example.com/foo/bar/:param.

All other URLs look like this: {{base-url}}/foo/bar/:param, using an environment variable for the schema and host.

CommonGuy commented 5 months ago

Can you also show the Settings of the operation itself? I think an endpoint is set, as the "Send" button is enabled:

For example: grafik

andreassiegel commented 5 months ago

Aha! You're right, there it is:

image

Is this the expected behavior or could the import be changed to only use the variable as the endpoint?

Also, the variable reference is not "detected" as an environment variable. Would it be possible or make sense to import {{my_var}} as {{env.my_var}}?

CommonGuy commented 5 months ago

Kreya currently recognizes templates paths such as {{scheme}}://{{host}}/path. It probably makes sense to also support {{base-url}}/path like in your example.

I'll see whether automatic conversion from {{base-url}} to {{ env.base_url }} should also be implemented, as hyphens are never valid in templates in Kreya.

andreassiegel commented 5 months ago

This sounds good! Thank you!

CommonGuy commented 4 months ago

This has been fixed in the latest beta version and will be released in the next stable version

CommonGuy commented 3 months ago

Kreya 1.15 has just been released.