Skip to content

Commit

Permalink
Merge pull request #5 from the-control-group/mitrej/jsonix
Browse files Browse the repository at this point in the history
Switch to @mitre/jsonix
  • Loading branch information
mike-marcacci authored Oct 4, 2024
2 parents ff57f47 + 6404e23 commit ff7011f
Show file tree
Hide file tree
Showing 24 changed files with 14,616 additions and 13,261 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [ main ]
schedule:
- cron: '29 7 * * 4'

Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Test"

on:
pull_request:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
matrix:
node-version: ['18.x', '20.x', '22.x']

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node:22
ENV JAVA_HOME=/opt/java/openjdk
COPY --from=eclipse-temurin:8-jre $JAVA_HOME $JAVA_HOME
ENV PATH="${JAVA_HOME}/bin:${PATH}"
CMD [ "npm", "run", "generate" ]
WORKDIR /workspace
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016 The Control Group Media Company
Copyright (c) 2016-2024 The Control Group Media Company

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ See tests for usage examples.
Code Generation
---------------

This code makes heavy use of [jsonix](https://github.com/highsource/jsonix) to generate and apply mappings from the [official LitleCo/Vantiv XSD files(https://github.com/LitleCo/litle-xml](https://github.com/LitleCo/litle-xml).
This code makes heavy use of [jsonix](https://github.com/mitre/jsonix) to generate and apply mappings from the official LitleCo/Vantiv XSD files, previously available at https://github.com/LitleCo/litle-xml.

To add a new version, simply drop the XSD files in the `xsd` directory, add any relevant `jaxb` customizations to a file in the `bindings` directory, and run:

```bash
npm run build
```
docker compose run --rm --build generate
```

6 changes: 5 additions & 1 deletion bin/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fs.readdirSync('./xsd')
.forEach((x) => {
const [filename, pkgName, pkgVersion] = x;
const child = spawn('java', [
'-jar', 'node_modules/jsonix/lib/jsonix-schema-compiler-full.jar',
'-jar', 'node_modules/jsonix-schema-compiler/lib/jsonix-schema-compiler-full.jar',

// output to the mappings directory
'-d', 'mappings',
Expand All @@ -33,6 +33,10 @@ fs.readdirSync('./xsd')
// error and assuming that the presence of any logs indicate a failure.
var code = 0;
child.stdout.on('data', (data) => {
console.log(`${filename}: ${data}`);
});

child.stderr.on('data', (data) => {
code = 1;
console.error(`${filename}: ${data}`);
});
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
generate:
build:
context: .
volumes:
- type: bind
source: .
target: /workspace
2 changes: 1 addition & 1 deletion lib/LitleOnlineRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var url = require('url');
var https = require('https');
var Jsonix = require('jsonix').Jsonix;
var Jsonix = require('@mitre/jsonix').Jsonix;

function LitleOnlineRequest (config, mapping) {
var self = this;
Expand Down
Loading

0 comments on commit ff7011f

Please sign in to comment.