You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tiagobento (via GitHub)" <gi...@apache.org> on 2023/12/18 19:30:35 UTC

[I] Standardize the use of path strings on Apache KIE Editors [incubator-kie-issues]

tiagobento opened a new issue, #783:
URL: https://github.com/apache/incubator-kie-issues/issues/783

   The Apache KIE Editors have been relying on the "Resource Content API" from `@kie-tools/workspace` from the start. We have several use cases for this that range from DMN Included Models to Serverless Workflow's `spec` directories.
   
   Until now, each Editor has come up with its own rules that define how paths should be:
   1.  sent around the "wire" (between Channel and Envelopes)
   2. serialized in files
   3. interpreted by requests such as `kogitoWorkspace_openFile`.
   
   This has become somewhat unmanageable, because as the relationship between Editors tightens, different components may have different expectations when it comes to paths. This leads to maintenance/debugging hell and ultimately, frustation and a lot of time spent.
   
   This issues aims to address this problem by creating a convention that ALL Apache KIE Editors follow. Here's my proposal:
   
   1. Envelopes that communicate with Channels using the "Resource Content API" must always talk in terms of "paths relative to the workspace root". Whatever "workspace root" is. This is up to the Channel to decide, and Envelope's should not care about that. This includes requests such as `kogitoWorkspace_openFile`, but also `kogitoEditor_contentChanged` (sometimes referred to as `setContent` as well) and of course `kogitoWorkspace_resourceContentRequest` and `kogitoWorkspace_resourceListRequest`.
   2. Editor components and files should always serialize paths as relative to its own directory, using the `./` and `../` notations at the start. This removes ambiguity as to where those paths are relative to and remove the need to define a "workspace root" in every context that interacts with this file.
   3. How channels treat their paths in storage/git is not in scope here.
   4. How paths are displayed on the screen is not in scope here, as different Editors may have different needs.
   5. Editor envelopes will know the `workspaceRootAbsolutePath` through the `EditorInitArgs` object that is sent as argument to `kogitoEditor_initRequest`
   
   
   ---
   
   
   This spreadsheet tries to summarize all the use-cases involving paths in all Apache KIE Editors. It is a live spreadsheet and will be updated as work on this front progresses.
   
   https://docs.google.com/spreadsheets/d/1XZLP7Zt-1QpQqOrUOTW0SDU-SHUFoDMIp-g4k1ZeCZw/edit#gid=0
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [I] Standardize the use of path strings on Apache KIE Editors [incubator-kie-issues]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento closed issue #783: Standardize the use of path strings on Apache KIE Editors
URL: https://github.com/apache/incubator-kie-issues/issues/783


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [I] Standardize the use of path strings on Apache KIE Editors [incubator-kie-issues]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on issue #783:
URL: https://github.com/apache/incubator-kie-issues/issues/783#issuecomment-1871525975

   After doing more and more experiments, @ljmotta and I agreed to introduce some more details to path string variable/property names.
   
   We need to differentiate between POSIX and OS-specific paths, and also between normalized and "explicitly relative" paths.
   
   1. 
   - `posixPathRelativeToXXX` --> POSIX paths always use forward slashes ("/")
   - `fsPathRelativeToXXX` (Following VS Code's convention for the Uri type) --> platform-specific paths can use forward slashes (`/`) and backslashes (`\`). 
   
   2.
   - `normalizedPathRelativeToXXX` --> Normalized relative paths never start with `./`, but may start with `../`.
   - `pathExplictlyRelativeToXXX` --> "Explicitly relative" paths always start with either `./` or `../`. 
   
   ---
   
   
   Combining the two new discriminators, we have:
   
   1. `normalizedPosixPathRelativeToXXX`
   2. `posixPathExplicitlyRelativeToXXX`
   3. `normalizedFsPathRelativeToXXX`
   4. `normalizedFsPathRelativeToXXX`
   
   
   Of course, for absolute paths, we can only discriminate between POSIX and platform-specific.
   
   1. `posixAbsolutePath`
   1. `fsAbsolutePath`
   
   --- 
   
   That's the current state of this, at least. I'm sure we're gonna find more to it :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [I] Standardize the use of path strings on Apache KIE Editors [incubator-kie-issues]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on issue #783:
URL: https://github.com/apache/incubator-kie-issues/issues/783#issuecomment-1861421210

   cc @paulovmr @ederign @caponetto @yesamer @ljmotta @danielzhe 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org