utils

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FixErrorParameters

func FixErrorParameters(body string) string

FixErrorParameters the error parameters come back from magento as objects rather than arrays of objects as their swagger docs specify EXPECTED:

"parameters":[{"fieldName":"max","fieldValue":"300"}]

ACTUAL:

"parameters":{"max":300}

CORRECTED:

"parameters":[{"fieldName":"max","fieldValue":"300"}]

however the

func FlattenValueArrays

func FlattenValueArrays(body string) string

FixJsonResponse one of the problems with the magento api is that it overloads the value:string fields with value:[]string and that breaks the json unmarshaller to fix this we use this function which intercepts the json string before it is json unmarshalled and alters the response flatten []string into a basic string EXPECTED:

"value":"4"

ACTUAL:

"value":["4","5","6"]

CORRECTED:

"value":"4,5,6"

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL