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

refactor: Adjusts search_deployment schema definitions with structure of new schema scaffolding command #1830

Merged
merged 2 commits into from
Jan 12, 2024

Conversation

AgustinBettati
Copy link
Member

Description

Link to any related issue(s): CLOUDP-221363

The content of the schema is not changed, with the exception of including Description and MarkdownDescription fields that are generated from description fields in the API Spec.

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contribution guidelines
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals, I defined an isolated PR with a relevant title as it will be used in the auto-generated changelog.

Further comments

@AgustinBettati AgustinBettati marked this pull request as ready for review January 11, 2024 12:01
@AgustinBettati AgustinBettati requested a review from a team as a code owner January 11, 2024 12:01
Copy link
Collaborator

@andreaangiolillo andreaangiolillo left a comment

Choose a reason for hiding this comment

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

LGTM

"github.com/hashicorp/terraform-plugin-framework/types"
)

func ResourceSchema(ctx context.Context) schema.Schema {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is creating the schema in a separate file a new convention in the repo? Is the what the scaffolding command will do?

Copy link
Member Author

Choose a reason for hiding this comment

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

correct, scaffolding command will be adjusted to this convention of having the schema and tf models in separate files.

"cluster_name": schema.StringAttribute{
Required: true,
Description: "Label that identifies the cluster to return the search nodes for.",
MarkdownDescription: "Label that identifies the cluster to return the search nodes for.",
Copy link
Member

@lantoli lantoli Jan 11, 2024

Choose a reason for hiding this comment

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

will scaffolding be used only for new TF plugin or also for older one? just to understand if it's enough to generate MarkdownDescription or we also want to generate Description.

or maybe having an input param (defaulted to new plugin?) in the tool if we want to support both?

Copy link
Member Author

Choose a reason for hiding this comment

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

The tool is limited to generating new TF framework code. I have left both definitions as they are both generated by the tool and provide unique value as per comments in the terraform code:

  • MarkdownDescription: used in various tooling, like the documentation generator
  • Description: used in various tooling, like the language server, to give practitioners more information about what this attribute is, what it's for, and how it should be used.

@AgustinBettati AgustinBettati merged commit d8eee33 into master Jan 12, 2024
33 checks passed
@AgustinBettati AgustinBettati deleted the CLOUDP-221363 branch January 12, 2024 12:01
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