Skip to content
This repository has been archived by the owner on Jul 10, 2021. It is now read-only.

Latest commit

 

History

History
57 lines (35 loc) · 1.46 KB

README.md

File metadata and controls

57 lines (35 loc) · 1.46 KB

standard-mapper

Used for mapping a document (e.g. https://github.com/andersju/gdpr-xml/blob/master/consolidated/gdpr-consolidated-en.xml) to standard format

Steps

Step 1

Clone repo

git clone [email protected]:slalom/standard-mapper.git
cd standard-mapper

Step 2

First convert document to json. For example, to convert gdpr-consolidated-en.xml to json use xq (yq https://github.com/kislyuk/yq comes with xq):

xq '.' gdpr-consolidated-en.xml > gdpr.json

A version has been saved to assets/gdpr-en.json

Step 3

Use jsonfiddle https://github.com/go-jsonfile/jsonfiddle to generate go types from json data

jsonfiddle j2s -i assets/gdpr-en.json

Create a file in types package and add generated types. For gdpr see pkg/types/gdpr.go

Step 4

Create a new mapper in mappers package. It will map from the types created in step #2 to standard types at pkg/types/standards.go. For gdpr see pkg/mappers/gdpr-mapper.go.

Step 5

Install go

brew install go

Step 6

Build and run standard mapper

export GO111MODULE=on
go build && ./standard-mapper --inputFile assets/gdpr-en.json --outputFile standard.json

This will map gdpr-en.json to standard format and write to file standard.json. It also creates the file unmarshal-debug.json that is result of marshal'ing gdpr-en.json