Generated JSON schema files are converted to all lowercase file names. This can break JSON schema references if capital letters are used in OpenAPI reference names.
Expected behavior
Maintain the same casing for generated JSON schema file names as defined in OpenAPI definitions.
Steps to reproduce
# Requires Go version 1.11 to use Go modules.
pip install openapi2jsonschema==0.8.0
openapi2jsonschema schema.yaml -o output
go mod init github.com/random/testing
go build schema.go
./schema
compile error: open /<full-file-path>/output/RequestData.json: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x6e8558]
goroutine 1 [running]:
github.com/xeipuuv/gojsonschema.(*Schema).validateDocument(0x0, 0x746e40, 0xc0000934a0, 0x0)
/root/go/pkg/mod/github.com/xeipuuv/gojsonschema@v1.1.0/validation.go:72 +0x78
github.com/xeipuuv/gojsonschema.(*Schema).Validate(0x0, 0x80f880, 0xc00008f880, 0x1, 0x1, 0x63)
/root/go/pkg/mod/github.com/xeipuuv/gojsonschema@v1.1.0/validation.go:64 +0x6b
main.main()
/<full-file-path/schema.go:13 +0x1cb
// schema.go
//
// Modify the full file path below to point to generated all.json file.
package main
import (
"fmt"
"github.com/xeipuuv/gojsonschema"
)
func main() {
sl := gojsonschema.NewSchemaLoader()
schema, err := sl.Compile(
gojsonschema.NewReferenceLoader("file:///<full-file-path>/output/all.json"))
fmt.Printf("compile error: %s\n", err)
document := gojsonschema.NewStringLoader(`{"type": "string"}`)
result, err := schema.Validate(document)
if result.Valid() {
fmt.Printf("document is valid\n")
} else {
fmt.Printf("document is not valid\n")
}
}
Description
Generated JSON schema files are converted to all lowercase file names. This can break JSON schema references if capital letters are used in OpenAPI reference names.
Expected behavior
Maintain the same casing for generated JSON schema file names as defined in OpenAPI definitions.
Steps to reproduce