legend-studio icon indicating copy to clipboard operation
legend-studio copied to clipboard

support function overloading

Open YannanGao-gs opened this issue 1 year ago • 1 comments

Summary

Fixes https://github.com/finos/legend-studio/issues/1211

https://user-images.githubusercontent.com/73408381/181059345-a64c2ea4-198e-463d-8197-cff7338c48c7.mov

How did you test this change?

  • [ ] Test(s) added
  • [x] Manual testing (please provide screenshots/recordings)
  • [ ] No testing (please provide an explanation)

YannanGao-gs avatar Jul 26 '22 16:07 YannanGao-gs

🦋 Changeset detected

Latest commit: 07d4d8c785ab33938bc0f64f7726103e40b400da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@finos/legend-query-builder Patch
@finos/legend-application-studio Minor
@finos/legend-graph Minor
@finos/legend-application-query Patch
@finos/legend-extension-dsl-data-space Patch
@finos/legend-extension-dsl-service Patch
@finos/legend-application-studio-bootstrap Patch
@finos/legend-extension-dsl-diagram Patch
@finos/legend-extension-dsl-mastery Patch
@finos/legend-extension-dsl-persistence-cloud Patch
@finos/legend-extension-dsl-persistence Patch
@finos/legend-extension-dsl-text Patch
@finos/legend-extension-format-morphir Patch
@finos/legend-extension-store-flat-data Patch
@finos/legend-extension-store-relational Patch
@finos/legend-extension-store-service-store Patch
@finos/legend-application-query-bootstrap Patch
@finos/legend-application-taxonomy-bootstrap Patch
@finos/legend-application-taxonomy Patch
@finos/legend-application Patch
@finos/legend-extension-format-json-schema Patch
@finos/legend-manual-tests Patch
@finos/legend-application-studio-deployment Patch
@finos/legend-application-query-deployment Patch
@finos/legend-application-taxonomy-deployment Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jul 26 '22 16:07 changeset-bot[bot]

###Data
Data testServiceStoreTestSuites::TestData
{
  ServiceStore
  #{
    [
      {
        request:
        {
          method: GET;
          url: '/employees/allEmployees';
        };
        response:
        {
          body:
            ExternalFormat
            #{
              contentType: 'application/json';
              data: '[ { "kerberos": "dummy kerberos", "employeeID": "dummy id", "title": "dummy title", "firstName": "dummy firstName", "lastName": "dummy lastname", "countryCode": "dummy countryCode" } ]';
            }#;
        };
      }
    ]
  }#
}


###Service
Service testServiceStoreTestSuites::TestService
{
  pattern: '/testServiceStoreTestSuites/testService';
  owners:
  [
    'dummy1',
    'dummy2'
  ];
  documentation: 'Service to test Service testSuite';
  autoActivateUpdates: true;
  execution: Single
  {
    query: |testServiceStoreTestSuites::Employee.all()->graphFetch(#{testServiceStoreTestSuites::Employee{kerberos,employeeID,title,firstName,lastName,countryCode}}#)->serialize(#{testServiceStoreTestSuites::Employee{kerberos,employeeID,title,firstName,lastName,countryCode}}#);
    mapping: testServiceStoreTestSuites::ServiceStoreMapping;
    runtime: testServiceStoreTestSuites::ServiceStoreRuntime;
  }
  testSuites:
  [
    testSuite1:
    {
      data:
      [
        connections:
        [
          connection_1:
            Reference
            #{
              testServiceStoreTestSuites::TestData
            }#
        ]
      ]
      tests:
      [
        test1:
        {
          asserts:
          [
            assert1:
              EqualToJson
              #{
                expected : 
                  ExternalFormat
                  #{
                    contentType: 'application/json';
                    data: '{ "kerberos": "dummy kerberos", "employeeID": "dummy id", "title": "dummy title", "firstName": "dummy firstName", "lastName": "dummy lastname", "countryCode": "dummy countryCode" }';
                  }#;
              }#
          ]
        }
      ]
    }
  ]
}


###ServiceStore
ServiceStore testServiceStoreTestSuites::ServiceStore
(
  ServiceGroup EmployeeServices
  (
    path : '/employees';

    Service EmployeeService
    (
      path : '/allEmployees';
      method : GET;
      response : [testServiceStoreTestSuites::Employee <- testServiceStoreTestSuites::employeeServiceStoreSchemaBinding];
      security : [];
    )
    Service EmployeeServiceWithParameters
    (
      path : '/employeesWithParameters';
      method : GET;
      parameters :
      (
        stringParam : String ( location = query ),
        integerParam : Integer ( location = query ),
        floatParam : Float ( location = query ),
        booleanParam : Boolean ( location = query )
      );
      response : [testServiceStoreTestSuites::Employee2 <- testServiceStoreTestSuites::employeeServiceStoreSchemaBinding];
      security : [];
    )
  )
)


###ExternalFormat
Binding testServiceStoreTestSuites::employeeServiceStoreSchemaBinding
{
  contentType: 'application/json';
  modelIncludes: [
    testServiceStoreTestSuites::Employee,
    testServiceStoreTestSuites::Employee2
  ];
}


###Pure
Class testServiceStoreTestSuites::Employee
{
  kerberos: String[1];
  employeeID: String[1];
  title: String[0..1];
  firstName: String[0..1];
  lastName: String[0..1];
  countryCode: String[0..1];
}

Class testServiceStoreTestSuites::Employee2
{
  stringParam: String[1];
  integerParam: Integer[1];
  floatParam: Float[1];
  booleanParam: Boolean[1];
}


###Mapping
Mapping testServiceStoreTestSuites::ServiceStoreMapping
(
  *testServiceStoreTestSuites::Employee[employee_set]: ServiceStore
  {
    ~service [testServiceStoreTestSuites::ServiceStore] EmployeeServices.EmployeeService
  }
  *testServiceStoreTestSuites::Employee2[employee2_set]: ServiceStore
  {
    ~service [testServiceStoreTestSuites::ServiceStore] EmployeeServices.EmployeeServiceWithParameters
    (
      ~request
      (
        parameters
        (
          stringParam = $this.stringParam,
          integerParam = $this.integerParam,
          floatParam = $this.floatParam,
          booleanParam = $this.booleanParam
        )
      )
    )
  }
)


###Connection
ServiceStoreConnection testServiceStoreTestSuites::ServiceStoreConnection
{
  store: testServiceStoreTestSuites::ServiceStore;
  baseUrl: 'https://prodUrl.com';
}


###Runtime
Runtime testServiceStoreTestSuites::ServiceStoreRuntime
{
  mappings:
  [
    testServiceStoreTestSuites::ServiceStoreMapping
  ];
  connections:
  [
    testServiceStoreTestSuites::ServiceStore:
    [
      connection_1: testServiceStoreTestSuites::ServiceStoreConnection
    ]
  ];
}

MauricioUyaguari avatar Oct 04 '22 21:10 MauricioUyaguari

Codecov Report

Merging #1339 (07d4d8c) into master (ebe9acf) will increase coverage by 0.01%. The diff coverage is 52.63%.

@@            Coverage Diff             @@
##           master    #1339      +/-   ##
==========================================
+ Coverage   40.66%   40.67%   +0.01%     
==========================================
  Files        1292     1292              
  Lines       56826    56884      +58     
  Branches    12805    12821      +16     
==========================================
+ Hits        23109    23140      +31     
- Misses      33630    33656      +26     
- Partials       87       88       +1     
Impacted Files Coverage Δ
...ger/action/changeDetection/DomainObserverHelper.ts 8.28% <ø> (ø)
...ts/explorer/QueryBuilderFunctionsExplorerPanel.tsx 10.52% <0.00%> (ø)
...rc/components/editor/edit-panel/FunctionEditor.tsx 14.28% <11.11%> (-0.19%) :arrow_down:
...udio/src/stores/sidebar-state/LocalChangesState.ts 15.65% <21.42%> (+0.36%) :arrow_up:
...studio/src/components/editor/side-bar/Explorer.tsx 75.77% <25.00%> (-1.73%) :arrow_down:
packages/legend-graph/src/graph/BasicModel.ts 63.63% <50.00%> (-0.08%) :arrow_down:
...aphManager/protocol/pure/v1/V1_PureGraphManager.ts 45.76% <71.42%> (-0.20%) :arrow_down:
...ation-studio/src/stores/shared/PackageTreeUtils.ts 80.39% <75.00%> (-0.15%) :arrow_down:
...ges/legend-graph/src/graph/helpers/DomainHelper.ts 62.20% <85.71%> (+1.37%) :arrow_up:
...gend-graph/src/graph/helpers/PureLanguageHelper.ts 66.66% <100.00%> (+0.66%) :arrow_up:
... and 4 more

codecov[bot] avatar Oct 17 '22 19:10 codecov[bot]