anz-bank / sysl

Sysl (pronounced "sizzle") is a system specification language
https://sysl.io
Apache License 2.0
122 stars 42 forks source link

Corrected sysl endpoint param type path #1046

Closed ericzhang6222 closed 4 years ago

ericzhang6222 commented 4 years ago

Fixes #1040

Changes proposed in this pull request:

"param": [
      {
       "name": "input",
       "type": {
        "typeRef": {
         "ref": {
          "appname": {
           "part": [
            "depserver"
           ]
          },
          "path": [
           "HelloRequest"
          ]
         }
        }
       }
      }
     ]

The appname field represents a reference to the app that contains the referenced type. The path field represents the type itself. This PR corrected code to follow this rule.

Checklist:

codecov[bot] commented 4 years ago

Codecov Report

Merging #1046 into master will increase coverage by 1.05%. The diff coverage is 83.92%.

@@            Coverage Diff             @@
##           master    #1046      +/-   ##
==========================================
+ Coverage   83.35%   84.40%   +1.05%     
==========================================
  Files          73       73              
  Lines       10609    10506     -103     
==========================================
+ Hits         8843     8868      +25     
+ Misses       1432     1328     -104     
+ Partials      334      310      -24     
Impacted Files Coverage Δ
pkg/database/db_test_utils.go 83.33% <0.00%> (ø)
pkg/diagrams/plantuml.go 0.00% <0.00%> (ø)
pkg/mod/fs.go 56.96% <48.07%> (-12.85%) :arrow_down:
pkg/importer/importer.go 63.15% <63.15%> (ø)
pkg/mermaid/datamodeldiagram/datamodeldiagram.go 61.90% <68.42%> (+3.33%) :arrow_up:
pkg/parse/parse.go 85.01% <71.87%> (+1.03%) :arrow_up:
pkg/parse/listener_impl.go 88.65% <77.08%> (-0.85%) :arrow_down:
pkg/parse/fs.go 90.90% <80.00%> (-9.10%) :arrow_down:
...g/mermaid/integrationdiagram/integrationdiagram.go 83.19% <82.45%> (-1.19%) :arrow_down:
pkg/importer/openapi.go 86.12% <85.45%> (-3.32%) :arrow_down:
... and 32 more
ericzhang6222 commented 4 years ago

@andrewemeryanz Looks like changes on pkg/parse/tests/petshop.sysl.golden.textpb and pkg/parse/tests/transform.sysl.golden.textpb are not correct, can you help confirm?

orlade-anz commented 4 years ago

The petshop case looks weird:

PetShopApiToModel [package="io.sysl.demo.petshop.views"]:
    !view apiToModel(petshop <: PetShopApi.PetShop):
        petshop -> <PetShopModel>(:

PetShopModel is an application, not a type; it shouldn't be legal in that context IIUC? Perhaps the behaviour is undefined?

In the transform case, Sometype is not defined anywhere, but it is used as a type, not an app, so populating path rather than appName.part seems correct?

ericzhang6222 commented 4 years ago

I tested sysl-go by make test with Sysl binary file has these changes, all tests passed.