SOQVER Prepare a source
English

Blog · Answer ·

How to validate a SO4AG file in CI before publishing

Install the pinned SO4AG validator, make local validation a required CI step, and check the public so4ag.json URL after deployment.

Install the SO4AG command-line validator from the v0.1.4 tag and run it against the local so4ag.json in your continuous integration (CI) pipeline. Make deployment depend on that check and keep the validator output in the job log so you can fix failures. After deploying, run the validator again against the public so4ag.json URL.

Install the validator from a version tag

Install the validator in your website project from the v0.1.4 tag. SO4AG (Source Objects for AGents) is an open format for business facts and a working draft at version 0.1. The v0.1.4 tag selects a release of the validator code.

npm install github:soqvercom/so4ag#v0.1.4

Run the install from the directory where your CI job will run npx. If your project tracks npm dependencies in version control, commit the updated package.json and lockfile so future CI runs can install the recorded dependencies with npm ci. If your website build has no npm setup, run the tagged install in the validation job. You can find the validator source in the SO4AG repository.

Make local validation a required step

Run the validator against the exact file your deployment will publish. Configure your CI pipeline so a failed validator command fails the job and prevents deployment.

npx so4ag-validate ./so4ag.json
  1. Check out the website code and install the validator. If the build generates or copies the source file, wait until that step finishes.
  2. Run the validator with the path to the file in the deployment output. Use ./so4ag.json when the file to publish is in the job’s working directory. Use the output path if the build puts it elsewhere.
  3. Keep the command’s output visible in the CI log. If you use separate validation and deployment jobs, configure deployment to require a successful validation job. If both commands run in one script, configure the script to stop when validation fails.

This placement matters when the build copies or generates files. A check against the repository copy can pass even if the generated file differs. Running the command on the deployment output checks what the next step is about to publish.

Use the CI log to find and fix the issue

Start with the first validator message and use any location or field it identifies to find the issue in the local file. Fix the underlying input or template if the file is generated, then rebuild and rerun the same command before retrying deployment.

An example is Example Plumbing, which publishes its source at https://plumbing.example/so4ag.json. Its build generates the file from a template, and the validator reports invalid JSON. The developer opens the generated file and spots a trailing comma after the last field. They remove the comma in the template, rebuild the site, and run the validator on the regenerated file. The next CI run checks the correction in the same place it found the issue.

When a message points to a fact, use the field name and the surrounding facts to locate it. A SO4AG fact carries its value, the conditions it applies under, its last applicable day, where the website states it, and whether the business states it at all. For a price that needs a condition or a starting amount, see what a price needs before a program can use it.

Validate the public file after deployment

Run a second check against the public HTTPS URL once the deployment finishes. This tests the file served to readers at /so4ag.json on your domain.

npx so4ag-validate https://example.com/so4ag.json

Replace the sample URL with your deployed file’s address. If the local check passes and the public check fails, open the deployed URL and inspect what it serves. A missing file or a response containing a web page gives you a place to start checking the deployment path. If the public file passes but you suspect it is an earlier version, compare it with the validated build output. For a manual check, use the public SO4AG validator.

Common questions

Does the validator need a SOQVER account?

SO4AG is free to use and requires no account. You can install the command-line validator directly from the version tag shown above.

How do I represent a fact the business leaves unstated?

Publish the fact as not stated. Zero, an empty value, and no limit express different meanings and are never substitutes for not stated.

Who confirms that the facts are true?

The business states its facts and stands behind them. The validator checks the source file against the format, and the business checks that the facts match what it offers.

Next step

Add the local command as a required step before publishing, then add the URL command after deployment. Keep the SO4AG developer guide handy when wiring both checks into your pipeline.

More articles

Answer ·

How do SO4AG conditions match a customer’s request?

Match SO4AG facts to known customer details, handle missing conditions without guessing, and check that a fact is current and stated.

Answer ·

When do I need an FAQ page and a SO4AG file?

Use an FAQ to explain recurring customer questions and a SO4AG file to publish specific business facts with their conditions, dates, and sources.

Answer ·

How to fix two pages that state different numbers

Compare the offer, audience, location, and dates on both pages, then use the business’s confirmed figures to update the pages and published facts.

Free website audit All articles