From 07e00ba2ceb6fc57ea7c3b128a5844728d423a70 Mon Sep 17 00:00:00 2001 From: Patrick Wieth Date: Sun, 25 Aug 2019 13:41:38 +0200 Subject: [PATCH] fixed absolute path shame and camelCase file names --- schema/{abilityschema.json => abilitySchema.json} | 0 schema/{cardschema.json => cardSchema.json} | 0 schema/{effectschema.json => effectSchema.json} | 0 schema/{propertyschema.json => propertySchema.json} | 0 serializeCard.go | 8 ++++++-- 5 files changed, 6 insertions(+), 2 deletions(-) rename schema/{abilityschema.json => abilitySchema.json} (100%) rename schema/{cardschema.json => cardSchema.json} (100%) rename schema/{effectschema.json => effectSchema.json} (100%) rename schema/{propertyschema.json => propertySchema.json} (100%) diff --git a/schema/abilityschema.json b/schema/abilitySchema.json similarity index 100% rename from schema/abilityschema.json rename to schema/abilitySchema.json diff --git a/schema/cardschema.json b/schema/cardSchema.json similarity index 100% rename from schema/cardschema.json rename to schema/cardSchema.json diff --git a/schema/effectschema.json b/schema/effectSchema.json similarity index 100% rename from schema/effectschema.json rename to schema/effectSchema.json diff --git a/schema/propertyschema.json b/schema/propertySchema.json similarity index 100% rename from schema/propertyschema.json rename to schema/propertySchema.json diff --git a/serializeCard.go b/serializeCard.go index a44126a..a4fba48 100644 --- a/serializeCard.go +++ b/serializeCard.go @@ -1,6 +1,7 @@ package cardobject import "fmt" +//import "io/ioutil" import "github.com/xeipuuv/gojsonschema" import "encoding/json" @@ -24,7 +25,10 @@ func ProcessCard (cardJson string) string { } func validateCard(s string) bool { - schemaLoader := gojsonschema.NewReferenceLoader("file://C:/Users/marius/Documents/goworkspace/src/github.com/DecentralCardGame/cardobject/schema/cardSchema.json") + //file, err := ioutil.ReadFile("schema/cardschema.json") + //fmt.Println(file) + + schemaLoader := gojsonschema.NewReferenceLoader("file://schema/cardSchema.json") documentLoader := gojsonschema.NewStringLoader(s) result, err := gojsonschema.Validate(schemaLoader, documentLoader) @@ -42,4 +46,4 @@ func validateCard(s string) bool { } return true//false } -} \ No newline at end of file +}