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

Refs not getting parsed correctly after updating to v0.116.0 #791

Open
rmarku opened this issue May 4, 2023 · 7 comments
Open

Refs not getting parsed correctly after updating to v0.116.0 #791

rmarku opened this issue May 4, 2023 · 7 comments

Comments

@rmarku
Copy link

rmarku commented May 4, 2023

I have been using v0.113.0 with some 3GPP OpenAPI files without a problem. Today I updated the lib to v0.116.0 and refs are not getting parsed correctly.

I have bisected the problem to this commit 47d329d in MR #768

imagen

  • Create a project with this code (go.mod too):
package main

import (
	"log"

	"github.com/getkin/kin-openapi/openapi3"
)

func main() {
	loader := openapi3.NewLoader()
	loader.IsExternalRefsAllowed = true

	_, err := loader.LoadFromFile("5G_APIs/TS29510_Nnrf_NFManagement.yaml")
	if err != nil {
		log.Fatalf("error %v", err)
	}
	log.Print("todo ok")
}
  • Add replace to kin-openapi dependency in go.mod
replace github.com/getkin/kin-openapi => ./kin-openapi
  • Clone kin-openapi in same folder to bisect
  • Clone 3GPP OpenApi version that gave me problems
git clone --depth 1 --branch TSG98-Rel16 https://forge.3gpp.org/rep/all/5G_APIs.git
  • Try with v0.116.0 version and v0.113.0 version (you can do bisect in the kin-openapi repo to find the commit.)

Thanks for the greate project

@QuinnCiccoretti
Copy link

QuinnCiccoretti commented May 15, 2023

+1 having a similar issue. Some external file refs
ref: './my_other_file.yaml#/components/schemas/myObject'
are not working for me. I get:

Loading error: bad data in '#components/schemas/myObject'  (expecting ref to schema object)'

though I assure you the schema object is correct and present.

@rmarku
Copy link
Author

rmarku commented Jun 8, 2023

Some more info. Each run gave a different error in the same test case as before (now with v0.118.0 version. I think this is a concurrency problem:

imagen

@rmarku
Copy link
Author

rmarku commented Jul 31, 2023

Still happening in v0.118.0

@ainsleyclark
Copy link

I'm also getting this error but it's far less descriptive:

bad data in "#/components/schemas" (expecting ref to schema object)%

@ainsleyclark
Copy link

@rmarku do you know the earliest version that will work and eradicate these errors?

@rmarku
Copy link
Author

rmarku commented Sep 9, 2023

@ainsleyclark v0.113.0 is working for me. All the newer ones are not working.

@rmarku
Copy link
Author

rmarku commented Oct 23, 2023

Just update that v0.120.0 is still failing.

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

No branches or pull requests

3 participants