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

Secondary artifact handling in case of relative $ref #1146

Closed
oliviernguyenquoc opened this issue Apr 22, 2024 · 7 comments
Closed

Secondary artifact handling in case of relative $ref #1146

oliviernguyenquoc opened this issue Apr 22, 2024 · 7 comments

Comments

@oliviernguyenquoc
Copy link

Describe the bug

Import job feature with OpenAPI with relative reference seems not to work.

Expected behavior

I try to import, with import job feature, an OpenAPI specs, with relative reference ("$ref" notation).

I selected the option "Is a Secondary Artifact ? - Just merge examples into existing API | Service definition."

I expect at least an error.

Don't know if "secondary artifact" feature can be used to merge $ref relative reference
If yes, I expect a well-formed url (see screenshot)

Actual behavior

In the first case ("Is a secondary artifact - ticked")

image

As you can see in the screenshot, import "seems" to be ok but the link produced is "https://microcks.192.168.49.2.xip.io/#/services/undefined"

How to Reproduce?

I used "commons/util/src/test/resources/io/github/microcks/util/openapi/weather-forecast-openapi-relative-ref.yaml" example, with an import job.

Microcks version or git rev

1.9.0

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

helm chart

Additional information

On minikube

@oliviernguyenquoc oliviernguyenquoc changed the title Second artifact handling in case of relative ref Secondary artifact handling in case of relative $ref Apr 22, 2024
@lbroudoux
Copy link
Member

I'm not sure to totally understand what you mean...

Looks like you've used https://github.com/microcks/microcks/raw/master/webapp/src/test/resources/io/github/microcks/util/openapi/weather-forecast-openapi-relative-ref.yaml but was it as a first or second artifact? What was the other one? Could you please share full procedure?

@oliviernguyenquoc
Copy link
Author

  1. I'm loading both weather-forecast-openapi-relative-ref.yaml and weather-forecast-schema.json in my repo.
  2. I'm entering the url of "weather-forecast-openapi-relative-ref.yaml"
  3. Check the box of "Is a Secondary Artifact ? - Just merge examples into existing API | Service definition."
  4. Click on "import"

To be honest, I'm not totally understanding whether secondary artifact is only about Postman Collection (or if it useful for my case of external JSON files)

Do you need something else ?

@lbroudoux
Copy link
Member

In that case, weather-forecast-schema.json is not a secondary artifact and you don't need them here.

You have one primary artifact, which for artifacts that are loosely coupled to the is weather-forecast-openapi-relative-ref.yaml (that is just split into multiple files using references). So you'll have to uncheck the box "Is a Secondary Artifacts?" and it should do the trick, importing the OpenAPI file and the JSON.

"Secondary artifacts" are for artifacts that are loosely coupled to the main one, using just service name and version to match things together. You can have secondary artifacts being Postman Collection or even OpenAPI docs - they will in that case act as an overlay of the primary.

@oliviernguyenquoc
Copy link
Author

Very clear, now.

So the only thing to fix is to return an error, instead of returning an "ok" notification + an undefined url, in the given scenario.

@lbroudoux
Copy link
Member

Sorry but once I only import https://github.com/microcks/microcks/raw/master/webapp/src/test/resources/io/github/microcks/util/openapi/weather-forecast-openapi-relative-ref.yaml as primary artifact, I don't succeed reproducing the bad link issue...

@oliviernguyenquoc
Copy link
Author

Ok I'll retry on my end.
I'll provide you a detail procedure

@oliviernguyenquoc
Copy link
Author

Sometime I have it. Sometime not. Can't have a fix scenario to reproduce it.

I close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants