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

Error "Must be a multiple of 0.01" for Value=19.99 #149

Closed
Slach opened this issue Apr 25, 2017 · 1 comment
Closed

Error "Must be a multiple of 0.01" for Value=19.99 #149

Slach opened this issue Apr 25, 2017 · 1 comment

Comments

@Slach
Copy link

Slach commented Apr 25, 2017

i have JSON schema

{
	"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
	"description": "Schema for Google Analytics Enhanced Ecommerce action data",
	"self": {
		"vendor": "com.google.analytics.enhanced-ecommerce",
		"name": "actionFieldObject",
		"format": "jsonschema",
		"version": "1-0-0"
	},

	"type": "object",
	"properties": {
		"id": {
			"type": "string",
			"maxLength": 500
		},
		"affiliation": {
			"type": "string",
			"maxLength": 500
		},
		"revenue": {
			"type": "number",
			"multipleOf": 0.01
		},
		"tax": {
			"type": "number",
			"multipleOf": 0.01
		},
		"shipping": {
			"type": "number",
			"multipleOf": 0.01
		},
		"coupon": {
			"type": "string",
			"maxLength": 500
		},
		"list": {
			"type": "string",
			"maxLength": 500
		},
		"step": {
			"type": "integer",
			"minimum": 0,
			"maximum": 2147483647
		},
		"option": {
			"type": "string",
			"maxLength": 500
		},
		"currency": {
			"type": "string",
			"maxLength": 3,
			"minLength": 3
		}
	},
	"additionalProperties": false
}

and JSON data

{
        "id": "T2",
        "affiliation": "Cloudpayments",
        "revenue": 19.99,
        "tax": 2.85,
        "shipping": 5.34,
        "coupon": "COUPON_EXAMPLE"
}

after validation i receive error

err.Type()=multiple_of 
err.Value()=19.99 
err.Context()=(root).revenue 
err.Description()=Must be a multiple of 0.01 
err.Details()=map[multiple:%!s(float64=0.01) field:revenue]

why ?

@johandorland
Copy link
Collaborator

This issue has been fixed in #172

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

2 participants