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

Adding Multifile API support #180

Open
wants to merge 93 commits into
base: development
Choose a base branch
from
Open

Conversation

erfemega
Copy link
Contributor

Add multifile API support:

  • Detect root files
  • Detect related files
  • Bundle
  • Adding support to Remote reference resolution

Detect root files example of usage

let serviceContent = fs.readFileSync(service, 'utf8'),
      typesContent = fs.readFileSync(types, 'utf8'),
      input = {
        type: 'multiFile',
        specificationVersion: '1.1',
        data: [
          {
            path: '/services.wsdl',
            content: serviceContent
          },
          {
            path: '/types.xsd',
            content: typesContent
          }
        ]
      },
      result = await detectRootFiles(input);

Output:

{
 "result": "true",
 "output": {
   "type": "rootFiles",
   "specification": { // corresponding specification and version info
     "type": "WSDL",
     "version": "1.1"
   },
   "data": [
     {
       "path": "services.wsdl" // corresponding path provided in input as fileName
     },
     ...
   ]
 }
}

Detect related files example of usage:

let service  = fs.readFileSync(servicePath, 'utf8'),
      data = fs.readFileSync(dataPath, 'utf8'),
      input = {
        type: 'multiFile',
        specificationVersion: '1.1',
        rootFiles: [
          {
            path: '/service.wsdl'
          }
        ],
        data: [
          {
            path: '/service.wsdl',
            content: service
          },
          {
            path: '/data.xsd',
            content: data
          }
        ]
      },
      result = await detectRelatedFiles(input);

Output:

{
 "result": "true",
 "output": {
   "type": "relatedFiles",
   "specification": { // corresponding specification and version info
     "type": "WSDL",
     "version": "1.1"
   },
   "data": [
     {
       "rootFile": {
         "path": "service.wsdl" // corresponding path provided in input as fileName
       },
       "relatedFiles": [
         {
           "path": "data.xsd" // corresponding path provided in input
         }
         ...
       ],
       "missingRelatedFiles": [
         {
           "path": "/missingfile.xsd"
         }
       ]
     },
     ...
   ]
 }
}

Bundle files:

let serviceContent = fs.readFileSync(service, 'utf8'),
      typesContent = fs.readFileSync(elements, 'utf8'),
      input = {
        type: 'multiFile',
        specificationVersion: '1.1',
        rootFiles: [
          {
            path: '/service.wsdl'
          }
        ],
        options: { },
        data: [
          {
            path: '/service.wsdl',
            content: serviceContent
          },
          {
            path: '/data.xsd',
            content: typesContent
          }
        ]
      },
      result = await bundle(input);

Output:

{
 "result": "true",
 "output": {
   "type": "bundledContent",
   "specification": { // corresponding specification and version info
     "type": "WSDL",
     "version": "1.1"
   },
   "data": [
     {
       "rootFile": {
         "path": "service.wsdl" // corresponding path provided in input as fileName
       },
       "bundledContent": "<Bundled content of given API Definition>",
       "referenceMap": {}
       
     },
     ...
   ]
 }
}

erfemega and others added 26 commits October 20, 2022 21:36
- Adding some output examples
- A repeated test was deleted
- Attribute placeholder is now injected through the nodeKiller method
Fix issue selecting roots when they are explicit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants