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

feat(dal,sdf,app): Reimplement variant_defs endpoints #3474

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented Mar 26, 2024

As we are moving away from the concept of SchemaVariantDefinitions, we want to move the metadata that was part of a SchemaVariantDefinition to be part of the SchemaVariant

This will allow us to start bringing back the authoring workflow without the need to have the concept of a SchemaVariantDefinition

This PR also re-implements the get_variant_def endpoint as well as renaming variant_def to be variant in the API routes

@github-actions github-actions bot added A-sdf Area: Primary backend API service [Rust] A-dal A-web A-dal-test labels Mar 26, 2024
@stack72 stack72 force-pushed the feat-dal-sdf-app-Merge-the-concepts-of-Schema-Variant-and-Definition branch from 7b17567 to 0ed72ce Compare March 26, 2024 20:36
@stack72
Copy link
Contributor Author

stack72 commented Mar 26, 2024

bors try

si-bors-ng bot added a commit that referenced this pull request Mar 26, 2024
@si-bors-ng
Copy link
Contributor

si-bors-ng bot commented Mar 26, 2024

try

Build succeeded:

@stack72
Copy link
Contributor Author

stack72 commented Mar 26, 2024

bors try

si-bors-ng bot added a commit that referenced this pull request Mar 26, 2024
@si-bors-ng
Copy link
Contributor

si-bors-ng bot commented Mar 26, 2024

try

Build succeeded:

@stack72 stack72 force-pushed the feat-dal-sdf-app-Merge-the-concepts-of-Schema-Variant-and-Definition branch from 8836957 to 67e467b Compare March 27, 2024 00:11
@stack72 stack72 changed the title feat(dal,sdf,app): Merge the concepts of Schema Variant and Definition feat(dal,sdf,app): Reimplement variant_defs endpoints Mar 27, 2024
@stack72 stack72 force-pushed the feat-dal-sdf-app-Merge-the-concepts-of-Schema-Variant-and-Definition branch 3 times, most recently from 580efa5 to d895c55 Compare March 27, 2024 00:19
@stack72
Copy link
Contributor Author

stack72 commented Mar 27, 2024

bors try

si-bors-ng bot added a commit that referenced this pull request Mar 27, 2024
@si-bors-ng
Copy link
Contributor

si-bors-ng bot commented Mar 27, 2024

try

Build succeeded:

@@ -104,7 +103,7 @@ export type AssetCloneRequest = Visibility & { id: AssetId };
const LOCAL_STORAGE_LAST_SELECTED_ASSET_ID_KEY = "si-open-asset-id";

export const assetDisplayName = (asset: Asset | AssetListEntry) =>
(asset.menuName ?? "").length === 0 ? asset.name : asset.menuName;
(asset.displayName ?? "").length === 0 ? asset.name : asset.displayName;
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. menuName was very old and we should have refactored it long ago.

lib/dal/src/action.rs Outdated Show resolved Hide resolved
lib/dal/src/func.rs Outdated Show resolved Hide resolved
Comment on lines +1894 to +1905
set_default_schema_variant_id(
ctx,
change_set_id,
&mut schema,
schema_spec
.data()
.as_ref()
.and_then(|data| data.default_schema_variant()),
variant_spec.unique_id(),
variant.id(),
)
.await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Love it!

lib/dal/src/pkg/import.rs Outdated Show resolved Hide resolved
Comment on lines +426 to +451
pub fn display_name(&self) -> Option<String> {
self.display_name.clone()
}

pub fn link(&self) -> Option<String> {
self.link.clone()
}

pub fn description(&self) -> Option<String> {
self.description.clone()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: feel free to ignore. We could use self.<option-field>.as_deref() so that we allow the caller to decide to clone.


#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SchemaVariantMetadataJson {
Copy link
Contributor

Choose a reason for hiding this comment

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

I love it! Great doc comments.

}

impl SchemaVariantJson {
// pub fn to_spec(
Copy link
Contributor

@nickgerace nickgerace Mar 27, 2024

Choose a reason for hiding this comment

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

Are we keeping this commented out because it is functionality we wish to restore soon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is functionality that will come back!

.unwrap_or(DEFAULT_SCHEMA_VARIANT_COLOR.into()),
component_type: variant_spec_data.component_type.into(),
link: variant_spec_data.link.as_ref().map(|l| l.to_string()),
description: None, // XXX - does this exist?
Copy link
Contributor

@nickgerace nickgerace Mar 27, 2024

Choose a reason for hiding this comment

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

Let's remove it in a follow up PR if not!

@@ -510,6 +510,70 @@ pub async fn get_func_view(ctx: &DalContext, func: &Func) -> FuncResult<GetFuncR
})
}

pub fn compile_return_types(ty: FuncBackendResponseType, kind: FuncBackendKind) -> &'static str {
Copy link
Contributor

Choose a reason for hiding this comment

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

I love it.

@nickgerace
Copy link
Contributor

Three things:

  1. I was on autopilot and accidentally brought my review style for Reimplement attributes view for component debug screen #3475. I was specifically asked for a nit-heavy, style and convention scoped review there. Apologies to @stack72!
  2. I'm going through my original review here to delete, edit, and/or comment on existing comments.
  3. @stack72 let me know that this isn't done yet too, so I'll keep that in mind when doing the above.

Copy link
Contributor

@nickgerace nickgerace left a comment

Choose a reason for hiding this comment

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

Followed up on #3474 (comment) and the comments have been cleaned up accordingly.

Great job!

@stack72 stack72 force-pushed the feat-dal-sdf-app-Merge-the-concepts-of-Schema-Variant-and-Definition branch 5 times, most recently from c2f3fdc to e6818ac Compare March 28, 2024 20:15
As we are moving away from the concept of SchemaVariantDefinitions, we want to move the metadata that was part of a SchemaVariantDefinition to be part of the SchemaVariant

This will allow us to start bringing back the authoring workflow without the need to have the concept of a SchemaVariantDefinition
stack72 added 5 commits March 28, 2024 20:27
By creating an edge between these nodes on the graph, we can understand what Asset func was used to create the schema variant
This still needs to be enhanced with all of the funcs associated with a schema variant. We need to ensure that those funcs are included as edges during the import process of a package
This was originally an edge but as this is a 1:1 mapping of func to schema variant it creates, we can make it part of the NodeWeight itself
Variant definitions no longer exist so we now use variants as the route instead
@stack72 stack72 force-pushed the feat-dal-sdf-app-Merge-the-concepts-of-Schema-Variant-and-Definition branch from e6818ac to 0e43468 Compare March 28, 2024 20:28
@keeb
Copy link
Contributor

keeb commented Mar 28, 2024

lgtm, executed basic sanity test of product and everything that should work is working

@stack72
Copy link
Contributor Author

stack72 commented Mar 28, 2024

bors try

si-bors-ng bot added a commit that referenced this pull request Mar 28, 2024
@si-bors-ng
Copy link
Contributor

si-bors-ng bot commented Mar 28, 2024

try

Build succeeded:

Copy link
Contributor

@nickgerace nickgerace left a comment

Choose a reason for hiding this comment

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

🚀🚀🚀🚀🚀🚀🚀🚀🚀

@stack72
Copy link
Contributor Author

stack72 commented Mar 28, 2024

bors merge

@si-bors-ng
Copy link
Contributor

si-bors-ng bot commented Mar 28, 2024

Build succeeded:

@si-bors-ng si-bors-ng bot merged commit 637d939 into main Mar 28, 2024
9 checks passed
@si-bors-ng si-bors-ng bot deleted the feat-dal-sdf-app-Merge-the-concepts-of-Schema-Variant-and-Definition branch March 28, 2024 22:31
si-bors-ng bot added a commit that referenced this pull request Apr 2, 2024
3497: Remove unused schema variant def module and unused auth prototype code (ENG-2426) r=nickgerace a=nickgerace

## Description

`SchemaVariantDefinition` no longer exists in the new engine, so this PR removes its remains from the dal.

<img src="https://media0.giphy.com/media/kVgCBJOy3PuHdqT5xQ/giphy.gif"/>

## Additional Note

This is a follow-up to #3474.

Co-authored-by: Nick Gerace <nick@systeminit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dal A-dal-test A-sdf Area: Primary backend API service [Rust] A-web
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants