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

[BUG] unable to access the scheme in go library #529

Closed
2 tasks done
Souvikns opened this issue Apr 22, 2024 · 2 comments
Closed
2 tasks done

[BUG] unable to access the scheme in go library #529

Souvikns opened this issue Apr 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Souvikns
Copy link
Member

Souvikns commented Apr 22, 2024

Describe the bug.

Unable to get access to the scheme, I get no error but scheme is nil.

func TestLoadSchemes(t *testing.T) {
	scheme, err := GetScheme("3.0.0")
	t.Log(err)
	t.Log(scheme)
	assert.Nil(t, err)
	assert.NotNil(t, scheme)
}
=== RUN   TestLoadSchemes
    /Users/postman/Documents/Programs/Asyncapi/parser-go/scheme/scheme_test.go:10: <nil>
    /Users/postman/Documents/Programs/Asyncapi/parser-go/scheme/scheme_test.go:11: []
    /Users/postman/Documents/Programs/Asyncapi/parser-go/scheme/scheme_test.go:13:
                Error Trace:    /Users/postman/Documents/Programs/Asyncapi/parser-go/scheme/scheme_test.go:13
                Error:          Expected value not to be nil.
                Test:           TestLoadSchemes
--- FAIL: TestLoadSchemes (0.00s)
FAIL
FAIL    github.com/Souvikns/parser-go/scheme    0.639s

Expected behavior

Should get scheme as []byte of the given version.

Screenshots

Screenshot 2024-04-22 at 1 01 03 PM

How to Reproduce

  1. First I installed the library using go get github.com/asyncapi/spec-json-schemas/v4
  2. Wrote a simple function to test the scheme function.
package main

import (
	"fmt"
	"log"
	scheme "github.com/asyncapi/spec-json-schemas/v2"
)

func main() {
	schema, err := scheme.Get("3.0.0")
	if err != nil {
		log.Fatalf(err.Error())	
	} else {
		fmt.Println(schema)
	}
}
  1. run the file using go run main.go

🥦 Browser

Mozilla Firefox

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

@Souvikns Souvikns added the bug Something isn't working label Apr 22, 2024
@smoya
Copy link
Member

smoya commented Apr 22, 2024

v4 of the package doesn't contain v3 spec schemas.
Please use v6 of the package + update the import paths (to end in /v6 rather than /v4.

@smoya
Copy link
Member

smoya commented Apr 24, 2024

Closing as you @Souvikns told me it is working now. Please reopen if applies.

@smoya smoya closed this as completed Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants