Variable Name Conflicts

Abierto
#371 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
typescript

Línea de trabajo

Read the linked context in accordproject/web-components#197 and trace how TemplateMark variables are expanded into CiceroMark, especially the repeated partyId fields for licensee and licensor. The issue proposes distinguishing the edited field name from the model variable name, but leaves the design unresolved. Done means updates to one party no longer change the other; the issue names no tests or source files.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Difficulty: Challenging maintainer-engaged Priority: High ⚠️ Type: Bug 🐛

Bug Report 🐛

In some cases, editing one variable within web-components will edit another variable making it impossible to distinguish them

Expected Behavior

Update to a variable should be propagated to the same variable in other places in the document, but not to different variables

Current Behavior

Example with the copyright license template:
MEandYOU

Both licensor and licensee variables have type AccordParty which seems to confuse the algorithm responsible for propagating variable changes. TemplateMark holds on to the licensee and licensor variables, but those are expanded (since they are complex types) before generating the CiceroMark.

CiceroMark, TemplateMark, and Model

Model
asset CopyrightLicenseContract extends AccordContract {
  /* the effective date */
  o DateTime effectiveDate

  /* licensee */
  o AccordParty licensee
  o String licenseeState
  o String licenseeEntityType
  o String licenseeAddress

  /* licensor */
  o AccordParty licensor
  o String licensorState
  o String licensorEntityType
  o String licensorAddress
...
CiceroMark
        {
          "$class": "org.accordproject.ciceromark.Variable",
          "value": ""Me"",
          "name": "partyId",
          "elementType": "String"
        }, 
        {
          "$class": "org.accordproject.commonmark.Text",
          "text": " ("Licensee"), a "
        }, 
        {
          "$class": "org.accordproject.ciceromark.Variable",
          "value": ""NY"",
          "name": "licenseeState",
          "elementType": "String"
        }, 
        {
          "$class": "org.accordproject.commonmark.Text",
          "text": " "
        }, 
        {
          "$class": "org.accordproject.ciceromark.Variable",
          "value": ""Company"",
          "name": "licenseeEntityType",
          "elementType": "String"
        }, 
        {
          "$class": "org.accordproject.commonmark.Text",
          "text": " with offices located at "
        }, 
        {
          "$class": "org.accordproject.ciceromark.Variable",
          "value": ""1 Broadway"",
          "name": "licenseeAddress",
          "elementType": "String"
        }, 
        {
          "$class": "org.accordproject.commonmark.Text",
          "text": ", and "
        }, 
        {
          "$class": "org.accordproject.ciceromark.Variable",
          "value": ""Myself"",
          "name": "partyId",
          "elementType": "String"
        }, 

TemplateMark
            {
              "$class": "org.accordproject.templatemark.VariableDefinition",
              "name": "licensee",
              "elementType": "org.accordproject.cicero.contract.AccordParty"
            }, 
            {
              "$class": "org.accordproject.commonmark.Text",
              "text": " ("Licensee"), a "
            }, 
            {
              "$class": "org.accordproject.templatemark.VariableDefinition",
              "name": "licenseeState",
              "elementType": "String"
            }, 
            {
              "$class": "org.accordproject.commonmark.Text",
              "text": " "
            }, 
            {
              "$class": "org.accordproject.templatemark.VariableDefinition",
              "name": "licenseeEntityType",
              "elementType": "String"
            }, 
            {
              "$class": "org.accordproject.commonmark.Text",
              "text": " with offices located at "
            }, 
            {
              "$class": "org.accordproject.templatemark.VariableDefinition",
              "name": "licenseeAddress",
              "elementType": "String"
            }, 
            {
              "$class": "org.accordproject.commonmark.Text",
              "text": ", and "
            }, 
            {
              "$class": "org.accordproject.templatemark.VariableDefinition",
              "name": "licensor",
              "elementType": "org.accordproject.cicero.contract.AccordParty"
            }, 

Possible Solution

We need to distinguish between the name of the field to be updated when editing, and the name of the variable in the model (field name in the owning type). For complex types, those are two different things.

Perhaps we should set elementType in the CiceroMark for this example to AccordParty and the name should be licensee -- it is then up to the editor/transformation to decide on the best way to edit or render the complex type (e.g. we could use a popup with Concerto form for some complex types). In the default case that means editing or rendering the identifier (String).

We will need to distinguish between --> AccordParty and AccordParty because we would use different editors for those.

However, the variable partyId is of type String. This could make pop ups difficult to handle.
Also, how would that work when a type has multiple variables (e.g., an Address)?

The bottom line is that you need more context (how did you get to that one variable).

Context

Please see https://github.com/accordproject/web-components/issues/197 for complete context

Lenguaje dominante
TypeScript
Estrellas
86
Forks
69
Merge medio
6 min
PR fusionados (30 d)
3

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de accordproject/markdown-transform

Todos los issues de accordproject/markdown-transform

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.