Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Commit

Permalink
Sort JSON-LD @context keys. Timezone in generated at (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcanterafonseca authored and jason-fox committed Oct 18, 2019
1 parent 1730513 commit e43a52f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/ldcontext_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import json
import yaml
import os
from datetime import datetime
from datetime import datetime, timezone
from argparse import ArgumentParser

# The aggregated @context will be stored here
Expand Down Expand Up @@ -54,7 +54,7 @@ def read_json(infile):

def write_json(data, outfile):
with open(outfile, 'w') as data_file:
data_file.write(json.dumps(data, indent=4))
data_file.write(json.dumps(data, indent=4, sort_keys=True))
data_file.write("\n")


Expand Down Expand Up @@ -307,7 +307,7 @@ def write_context_file():

ld_context = {
'@context': aggregated_context,
'generatedAt': datetime.now().replace(microsecond=0).isoformat()
'generatedAt': datetime.now(timezone.utc).replace(microsecond=0).isoformat()
}

write_json(ld_context, 'context.jsonld')
Expand Down

0 comments on commit e43a52f

Please sign in to comment.