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

docs: Optional is False by default rather than True. #5288

Conversation

FragmentedPacket
Copy link
Contributor

The documentation advises that optional is true by default, but it's actually false.

Copy link
Contributor

@ogenstad ogenstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't merge this as is. The reason is that attribute.mdx is a generated file (by invoke docs.generate), so this change needs to happen in the source location.

It also highlights the fact that the CI should have failed for this PR but doesn't as the job would have been filtered out. We need to change the CI to ensure that we run the job that executes invoke docs.validate if any of these files are changed. Currently this doesn't happen:

  validate-generated-documentation:
    if: |
      always() && !cancelled() &&
      !contains(needs.*.result, 'failure') &&
      !contains(needs.*.result, 'cancelled') &&
      needs.files-changed.outputs.python == 'true'
    needs: ["files-changed", "yaml-lint", "python-lint"]
    runs-on: "ubuntu-22.04"
    timeout-minutes: 5
    steps:
      - name: "Check out repository code"
        uses: "actions/checkout@v4"
        with:
          submodules: true
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: "Setup Python environment"
        run: |
          pipx install poetry
          poetry config virtualenvs.create true --local
          poetry env use 3.12
      - name: "Install dependencies"
        run: "poetry install --no-interaction --no-ansi"
      - name: "Setup environment"
        run: "pip install invoke toml"
      - name: "Validate generated documentation"
        run: "poetry run invoke docs.validate"

@BeArchiTek
Copy link
Contributor

BeArchiTek commented Dec 23, 2024

This file is auto-generated by invoke docs.generate, so your changes will be rewrite in the next generation.

Copy link

codspeed-hq bot commented Dec 23, 2024

CodSpeed Performance Report

Merging #5288 will degrade performances by 50.17%

Comparing FragmentedPacket:may-202412-docs-reference-schema-attribute-optional (1c8a013) with stable (4d32ce6)

Summary

❌ 1 (👁 1) regressions
✅ 9 untouched benchmarks

Benchmarks breakdown

Benchmark stable FragmentedPacket:may-202412-docs-reference-schema-attribute-optional Change
👁 test_get_menu 236 ms 473.7 ms -50.17%

@FragmentedPacket
Copy link
Contributor Author

We can't merge this as is. The reason is that attribute.mdx is a generated file (by invoke docs.generate), so this change needs to happen in the source location.

It also highlights the fact that the CI should have failed for this PR but doesn't as the job would have been filtered out. We need to change the CI to ensure that we run the job that executes invoke docs.validate if any of these files are changed. Currently this doesn't happen:

  validate-generated-documentation:
    if: |
      always() && !cancelled() &&
      !contains(needs.*.result, 'failure') &&
      !contains(needs.*.result, 'cancelled') &&
      needs.files-changed.outputs.python == 'true'
    needs: ["files-changed", "yaml-lint", "python-lint"]
    runs-on: "ubuntu-22.04"
    timeout-minutes: 5
    steps:
      - name: "Check out repository code"
        uses: "actions/checkout@v4"
        with:
          submodules: true
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: "Setup Python environment"
        run: |
          pipx install poetry
          poetry config virtualenvs.create true --local
          poetry env use 3.12
      - name: "Install dependencies"
        run: "poetry install --no-interaction --no-ansi"
      - name: "Setup environment"
        run: "pip install invoke toml"
      - name: "Validate generated documentation"
        run: "poetry run invoke docs.validate"

I believe I have this trigger correctly now. I tested this in https://github.com/opsmill/infrahub/actions/runs/12469863582/job/34803886595?pr=5288.

@dgarros dgarros requested review from ogenstad and a team December 31, 2024 08:27
@FragmentedPacket FragmentedPacket dismissed ogenstad’s stale review December 31, 2024 15:30

Addressed by adding doc file paths to be validated

@FragmentedPacket FragmentedPacket merged commit 9e69737 into opsmill:stable Dec 31, 2024
31 checks passed
@FragmentedPacket FragmentedPacket deleted the may-202412-docs-reference-schema-attribute-optional branch December 31, 2024 15:30
gmazoyer pushed a commit that referenced this pull request Jan 9, 2025
* Optional is  by default rather than .

* Update source of attribute optional doc so it will be auto-generated.

* Testing to see if pipeline works with new changes to check for auto generated docs changes.

* Add back the upstream Python change for optional attribute default to be False.
wartraxx51 pushed a commit that referenced this pull request Jan 20, 2025
* Optional is  by default rather than .

* Update source of attribute optional doc so it will be auto-generated.

* Testing to see if pipeline works with new changes to check for auto generated docs changes.

* Add back the upstream Python change for optional attribute default to be False.
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.

3 participants