Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop automatic git commits of schema-reference.md #998

Merged
merged 3 commits into from
Jul 5, 2022

Conversation

jrcheli
Copy link
Contributor

@jrcheli jrcheli commented Jun 13, 2022

resolves #997

@jrcheli jrcheli requested a review from michalbiesek June 13, 2022 20:16
- `json-dereference` always return 0, even in case of
  syntax error
- to overcome this limitation we check if temporary
  schema.json file is generated
@michalbiesek
Copy link
Contributor

michalbiesek commented Jun 14, 2022

@jrcheli Looks good to me.

I allowed myself to add one commit. This is not strictly related to your change. Let me describe what I have added:

  • During the schema markdown generation process we start by resolving references "$ref": e.g.
  "properties": {
    "type": {
      "$ref": "definitions/envelope.schema.json#/$defs/event_type"
    },

This is done by json-dereference.
If "$ref" is invalid e.g. points to no existing definition we will retrieve the syntax error like e.g. following:

SyntaxError: Error resolving $ref pointer "/home/node/schemas/definitions/envelope.schema.json#/$defs/event_type3". 

But the json-dereference will still return 0 - just like in the case of success. I have added an additional logic to check if the file with resolved references was generated. If a file with fixed references was not generated, exit 1 will fail the job.

After merging this Pull Request we should check if the new Github Action is working correctly even with a simple change in a single JSON schema file.

@michalbiesek
Copy link
Contributor

@jrcheli Not sure if it is worthy or not - since I am not aware of the exact process of how deploy works.
Should we extend the .gitignore file with the following entry:

/website/src/pages/docs/schema-reference.md

My rationale is to prevent situation including the /website/src/pages/docs/schema-reference.md file in the commit ?

@jrcheli jrcheli merged commit d954b77 into master Jul 5, 2022
@jrcheli jrcheli deleted the feature/997-streamline-schema-docs-generate branch July 5, 2022 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop auto-commits to website/src/pages/docs/schema-reference.md
2 participants