Navigation Menu

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

[Spike] API Connect / LoopBack 4 integration #4115

Closed
4 tasks done
dhmlau opened this issue Nov 12, 2019 · 30 comments
Closed
4 tasks done

[Spike] API Connect / LoopBack 4 integration #4115

dhmlau opened this issue Nov 12, 2019 · 30 comments
Assignees
Labels
Milestone

Comments

@dhmlau
Copy link
Member

dhmlau commented Nov 12, 2019

Suggestion

APIConnect v2018 now has limited support in OpenAPIv3. See demo and limitations.

Use Cases

There might be various use cases, I think for one use case, we can:

  1. create LoopBack 4 application and expose some REST APIs
  2. Using APIConnect cli, import existing OpenAPI from step 1. (From my understanding, there is no UI support for OpenAPIv3, so need to do it through CLI)
  3. Once the API has been imported, change the target-url to point to that REST API endpoint
  4. publish to catalog
  5. set up portal
  6. test it within portal

Note: this is based on my limited understanding of APIConnect and things might change as well. We can get @smartmouse to help if needed.

Acceptance criteria

We should:

  • Import OpenAPI v3 spec from a LoopBack 4 API into IBM APIConnect
  • Try to create subscriptions for the API from IBM Advanced Portal
  • Test the LB endpoint from IBM APIConnect after importing
  • investigate if General limitations and Security limitations in APIC Knowledge Center would affect us

cc @raymondfeng @bajtos @deepakrkris

@jannyHou
Copy link
Contributor

  • LB provide security def + api def + additional policies.
  • Make sure apic could manage the apis exposed by lb4.
  • APIC supports oauth 2, make sure the spec created by lb4 is consumable by apic.
  • Feature: gateway enforce some policies and passes context to LB4 app.

@deepakrkris
Copy link
Contributor

I tried importing the api spec from the LoopBack todo example app to apic and had the following errors:

DEEPAKs-MacBook-Pro:~ deepakrajamohan$ ./apic-slim products:publish --scope catalog --server admin11.loki.dev.ciondemand.com  --org ibm --catalog sandbox --mode apim  todo.yaml
Error: The multipart 'openapi' field contains an OpenAPI definition (unnamed):1.0.0 (todolist24) that has validation errors.
  - Additional property /todo-lists is not allowed (context: (root).paths, line: 518, col: 24)
Additional property /todo-lists/{id} is not allowed (context: (root).paths, line: 336, col: 29)
Additional property /todos is not allowed (context: (root).paths, line: 968, col: 19)
Additional property /todos/{id} is not allowed (context: (root).paths, line: 747, col: 24)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.NewTodo, line: 1341, col: 24)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.NewTodo.additionalProperties, line: 1361, col: 41)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.NewTodoInTodoList, line: 1247, col: 34)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.NewTodoInTodoList.additionalProperties, line: 1267, col: 41)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.NewTodoList, line: 1309, col: 28)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.NewTodoList.additionalProperties, line: 1323, col: 41)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.Todo, line: 1223, col: 21)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.Todo.additionalProperties, line: 1245, col: 41)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoList, line: 1291, col: 25)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoList.additionalProperties, line: 1307, col: 41)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoListImage, line: 1127, col: 30)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoListImage.additionalProperties, line: 1143, col: 41)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoListImageWithRelations, line: 1201, col: 43)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoListImageWithRelations.additionalProperties, line: 1221, col: 41)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoListPartial, line: 1325, col: 32)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoListPartial.additionalProperties, line: 1339, col: 41)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoListWithRelations, line: 1173, col: 38)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoListWithRelations.additionalProperties, line: 1199, col: 41)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoPartial, line: 1269, col: 28)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoPartial.additionalProperties, line: 1289, col: 41)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoWithRelations, line: 1145, col: 34)
Must validate one and only one schema (oneOf) (context: (root).components.schemas.TodoWithRelations.additionalProperties, line: 1171, col: 41)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists.get.parameters.0, line: 617, col: 21)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists.get.parameters.0.schema, line: 622, col: 35)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists.get.parameters.0.schema.additionalProperties, line: 708, col: 53)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists.get.parameters.0.schema.properties, line: 624, col: 43)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists.get.parameters.0.schema.properties.additionalProperties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists.get.parameters.0.schema.properties.items, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists.get.parameters.0.schema.properties.items.properties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists.get.parameters.0.schema.properties.items.properties.additionalProperties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists.get.parameters.0.schema.properties.items.properties.properties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1, line: 397, col: 21)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema, line: 402, col: 35)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.additionalProperties, line: 488, col: 53)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties, line: 404, col: 43)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.additionalProperties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.items, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.items.properties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.items.properties.additionalProperties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.items.properties.properties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos.get.parameters.0, line: 1020, col: 21)
Must validate one and only one schema (oneOf) (context: (root).paths./todos.get.parameters.0.schema, line: 1025, col: 35)
Must validate one and only one schema (oneOf) (context: (root).paths./todos.get.parameters.0.schema.additionalProperties, line: 1117, col: 53)
Must validate one and only one schema (oneOf) (context: (root).paths./todos.get.parameters.0.schema.properties, line: 1027, col: 43)
Must validate one and only one schema (oneOf) (context: (root).paths./todos.get.parameters.0.schema.properties.additionalProperties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos.get.parameters.0.schema.properties.items, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos.get.parameters.0.schema.properties.items.properties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos.get.parameters.0.schema.properties.items.properties.additionalProperties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos.get.parameters.0.schema.properties.items.properties.properties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1, line: 841, col: 21)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema, line: 846, col: 35)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema.additionalProperties, line: 938, col: 53)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema.properties, line: 848, col: 43)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.additionalProperties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.items, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.items.properties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.items.properties.additionalProperties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.items.properties.properties, line: 0, col: 0)
Property "NewTodo" does not match pattern <no value> (context: (root).components.schemas, line: 1341, col: 24)
Property "NewTodoInTodoList" does not match pattern <no value> (context: (root).components.schemas, line: 1247, col: 34)
Property "NewTodoList" does not match pattern <no value> (context: (root).components.schemas, line: 1309, col: 28)
Property "Todo" does not match pattern <no value> (context: (root).components.schemas, line: 1223, col: 21)
Property "TodoList" does not match pattern <no value> (context: (root).components.schemas, line: 1291, col: 25)
Property "TodoListImage" does not match pattern <no value> (context: (root).components.schemas, line: 1127, col: 30)
Property "TodoListImageWithRelations" does not match pattern <no value> (context: (root).components.schemas, line: 1201, col: 43)
Property "TodoListPartial" does not match pattern <no value> (context: (root).components.schemas, line: 1325, col: 32)
Property "TodoListWithRelations" does not match pattern <no value> (context: (root).components.schemas, line: 1173, col: 38)
Property "TodoPartial" does not match pattern <no value> (context: (root).components.schemas, line: 1269, col: 28)
Property "TodoWithRelations" does not match pattern <no value> (context: (root).components.schemas, line: 1145, col: 34)
components.schemas.NewTodo.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).components.schemas.NewTodo.additionalProperties, line: 1361, col: 41)
components.schemas.NewTodoInTodoList.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).components.schemas.NewTodoInTodoList.additionalProperties, line: 1267, col: 41)
components.schemas.NewTodoList.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).components.schemas.NewTodoList.additionalProperties, line: 1323, col: 41)
components.schemas.Todo.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).components.schemas.Todo.additionalProperties, line: 1245, col: 41)
components.schemas.TodoList.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).components.schemas.TodoList.additionalProperties, line: 1307, col: 41)
components.schemas.TodoListImage.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).components.schemas.TodoListImage.additionalProperties, line: 1143, col: 41)
components.schemas.TodoListImageWithRelations.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).components.schemas.TodoListImageWithRelations.additionalProperties, line: 1221, col: 41)
components.schemas.TodoListPartial.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).components.schemas.TodoListPartial.additionalProperties, line: 1339, col: 41)
components.schemas.TodoListWithRelations.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).components.schemas.TodoListWithRelations.additionalProperties, line: 1199, col: 41)
components.schemas.TodoPartial.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).components.schemas.TodoPartial.additionalProperties, line: 1289, col: 41)
components.schemas.TodoWithRelations.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).components.schemas.TodoWithRelations.additionalProperties, line: 1171, col: 41)
paths./todo-lists.get.parameters.0.schema.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todo-lists.get.parameters.0.schema.additionalProperties, line: 708, col: 53)
paths./todo-lists.get.parameters.0.schema.properties.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todo-lists.get.parameters.0.schema.properties.additionalProperties, line: 0, col: 0)
paths./todo-lists.get.parameters.0.schema.properties.items.properties.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todo-lists.get.parameters.0.schema.properties.items.properties.additionalProperties, line: 0, col: 0)
paths./todo-lists.get.parameters.0.schema.properties.items.properties.properties.properties is of incorrect type. Expected: object, Given: null (context: (root).paths./todo-lists.get.parameters.0.schema.properties.items.properties.properties.properties, line: 0, col: 0)
paths./todo-lists/{id}.get.parameters.1.schema.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.additionalProperties, line: 488, col: 53)
paths./todo-lists/{id}.get.parameters.1.schema.properties.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.additionalProperties, line: 0, col: 0)
paths./todo-lists/{id}.get.parameters.1.schema.properties.items.properties.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.items.properties.additionalProperties, line: 0, col: 0)
paths./todo-lists/{id}.get.parameters.1.schema.properties.items.properties.properties.properties is of incorrect type. Expected: object, Given: null (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.items.properties.properties.properties, line: 0, col: 0)
paths./todos.get.parameters.0.schema.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todos.get.parameters.0.schema.additionalProperties, line: 1117, col: 53)
paths./todos.get.parameters.0.schema.properties.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todos.get.parameters.0.schema.properties.additionalProperties, line: 0, col: 0)
paths./todos.get.parameters.0.schema.properties.items.properties.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todos.get.parameters.0.schema.properties.items.properties.additionalProperties, line: 0, col: 0)
paths./todos.get.parameters.0.schema.properties.items.properties.properties.properties is of incorrect type. Expected: object, Given: null (context: (root).paths./todos.get.parameters.0.schema.properties.items.properties.properties.properties, line: 0, col: 0)
paths./todos/{id}.get.parameters.1.schema.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todos/{id}.get.parameters.1.schema.additionalProperties, line: 938, col: 53)
paths./todos/{id}.get.parameters.1.schema.properties.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.additionalProperties, line: 0, col: 0)
paths./todos/{id}.get.parameters.1.schema.properties.items.properties.additionalProperties is of incorrect type. Expected: object, Given: string (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.items.properties.additionalProperties, line: 0, col: 0)
paths./todos/{id}.get.parameters.1.schema.properties.items.properties.properties.properties is of incorrect type. Expected: object, Given: null (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.items.properties.properties.properties, line: 0, col: 0)
DEEPAKs-MacBook-Pro:~ deepakrajamohan$ 

@deepakrkris
Copy link
Contributor

deepakrkris commented Jan 10, 2020

I was able to import a converted YAML file from the Loopback api JSON spec into APIC.
The biggest challenge was to get a well formatted YAML. I also did a few modifications as below:

1 - added a x-ibm-configuration section in the top below the api info section

x-ibm-configuration:
 assembly:
   execute:
   - invoke:
       title: invoke
       version: 2.0.0
       target-url: 'http://apicsrv01.dp.rtp.raleigh.ibm.com/sample.json'
 cors:
   enabled: true
 enforced: true
 phase: realized
 testable: true
 gateway: datapower-api-gateway  

2 - changed the info section as below. Original LoopBack spec has capital letters for title which apic complains about. Also added x-ibm-name

info:
  x-ibm-name: todolist24
  version: 1.0.0
  title: todolist24
  license:
    name: MIT

3 - the below scope section in all filter object definition creates errors when importing to apic. So I have removed it for time being.

UPDATE: I checked by importing the openapi file in JSON format (as downloaded directly from LB app) to apic and the above error does not occur. Error occurs only for converted YAML format.

                  scope: 
                    properties: 
                      where: 
                        type: "object"
                        additionalProperties: false
                      fields: 
                        type: "object"
                        properties: 
                        additionalProperties: false
                      offset: 
                        type: "integer"
                        minimum: 0
                      limit: 
                        type: "integer"
                        minimum: 1
                        example: "100"
                      skip: 
                        type: "integer"
                        minimum: 0
                      order: 
                        type: "array"
                        items: 
                          type: "string"
                    additionalProperties: false

@deepakrkris
Copy link
Contributor

deepakrkris commented Jan 10, 2020

Without removing the scope section in the filter object definition the following errors are thrown while importing to APIC. I am investigating the root cause.

UPDATE: I checked by importing the openapi file in JSON format (as downloaded directly from LB app) to apic and the above error does not occur. Error occurs only for converted YAML format.

DEEPAKs-MacBook-Pro:~ deepakrajamohan$ ./apic-slim products:publish --scope catalog --server admin11.loki.dev.ciondemand.com  --org ibm --catalog sandbox --mode apim  todo.yaml
Error: The multipart 'openapi' field contains an OpenAPI definition (unnamed):1.0.0 (todolist24) that has validation errors.
  - Additional property /todo-lists/{id} is not allowed (context: (root).paths, line: 336, col: 29)
Additional property /todos/{id} is not allowed (context: (root).paths, line: 714, col: 24)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1, line: 397, col: 21)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema, line: 402, col: 35)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties, line: 404, col: 43)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.items, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.items.properties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.items.properties.properties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1, line: 808, col: 21)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema, line: 813, col: 35)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema.properties, line: 815, col: 43)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.items, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.items.properties, line: 0, col: 0)
Must validate one and only one schema (oneOf) (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.items.properties.properties, line: 0, col: 0)
paths./todo-lists/{id}.get.parameters.1.schema.properties.items.properties.properties.properties is of incorrect type. Expected: object, Given: null (context: (root).paths./todo-lists/{id}.get.parameters.1.schema.properties.items.properties.properties.properties, line: 0, col: 0)
paths./todos/{id}.get.parameters.1.schema.properties.items.properties.properties.properties is of incorrect type. Expected: object, Given: null (context: (root).paths./todos/{id}.get.parameters.1.schema.properties.items.properties.properties.properties, line: 0, col: 0)

@deepakrkris
Copy link
Contributor

deepakrkris commented Jan 10, 2020

So far I have imported the following YAML into APIC after making the above changes. I will have to test the LoopBack endpoint and confirm if the import was all good.

todolist-apispec.yaml.txt

@deepakrkris
Copy link
Contributor

I am able to check all the api endpoints from IBM Portal
Screen Shot 2020-01-10 at 4 39 34 PM

@deepakrkris
Copy link
Contributor

IBM Advanced Portal is able to digest all information from the uploaded api spec of the LoopBack app.

Screen Shot 2020-01-10 at 4 55 55 PM

Screen Shot 2020-01-10 at 4 56 09 PM

@deepakrkris
Copy link
Contributor

I am able to subscribe to the ToDo API product from the IBM Portal.
Screen Shot 2020-01-10 at 4 56 09 PM

@dhmlau
Copy link
Member Author

dhmlau commented Jan 13, 2020

@deepakrkris, the error you listed in #4115 (comment), did LB generate a valid OpenAPI spec (I thought we do) or it's some validation inside APIC? Thanks.

@deepakrkris
Copy link
Contributor

@deepakrkris, the error you listed in #4115 (comment), did LB generate a valid OpenAPI spec (I thought we do) or it's some validation inside APIC? Thanks.

@dhmlau it is the validation inside APIC that is causing the issue. I am trying to find out what apic would accept for the scope block.

@deepakrkris
Copy link
Contributor

I am able to invoke the todo-list LB app hosted in AWS via an APIC gateway.
The AWS app is http://ec2-3-88-137-62.compute-1.amazonaws.com:3000/todos?filter=%7B%22include%22%3A%5B%7B%22relation%22%3A%22todoList%22%7D%5D%7D
so APIC instance in https://admin11-rgw.loki.dev.ciondemand.com/ibm/sandbox/todolist.io/v1/todos is invoking the above LB app in AWS

@deepakrkris
Copy link
Contributor

deepakrkris commented Jan 21, 2020

Following are the only pending items in this spike now:
1 - investigate if General limitations and Security limitations in APIC Knowledge Center would affect us
2 - scope section in all filter object definition creates errors when importing to apic (#4115 (comment))

UPDATE: I checked by importing the openapi file in JSON format (as downloaded directly from LB app) to apic and the above error does not occur any more. The error occurs only in the converted YAML format.

                  scope: 
                    properties: 
                      where: 
                        type: "object"
                        additionalProperties: false
                      fields: 
                        type: "object"
                        properties: 
                        additionalProperties: false
                      offset: 
                        type: "integer"
                        minimum: 0
                      limit: 
                        type: "integer"
                        minimum: 1
                        example: "100"
                      skip: 
                        type: "integer"
                        minimum: 0
                      order: 
                        type: "array"
                        items: 
                          type: "string"
                    additionalProperties: false

@deepakrkris
Copy link
Contributor

deepakrkris commented Jan 21, 2020

error mentioned in #4115 (comment) does not occur when importing the openapi file in JSON format (as downloaded directly from LB app) to apic. so the error occurs only in the converted YAML format.

todoList_api_spec.zip

Below screenshot: Invoking the gateway url, apic gets data from Backend
( LoopBack TodoList API hosted in aws http://ec2-3-88-137-62.compute-1.amazonaws.com:3000/todos?filter=%7B%22include%22%3A%5B%7B%22relation%22%3A%22todoList%22%7D%5D%7D )

Screen Shot 2020-01-21 at 11 48 22 PM

@deepakrkris
Copy link
Contributor

deepakrkris commented Jan 21, 2020

Follow-up tasks:

  1. Need to update loopback open-api spec as per [Spike] API Connect / LoopBack 4 integration #4115 (comment)
  2. Additional spike necessary with LoopBack next authentication and authorization features.
  3. Additional testing with other gateway policies (see : https://www.ibm.com/support/knowledgecenter/en/SSMNED_2018/com.ibm.apic.toolkit.doc/rapic_oai3_support.html). Currently only invoke policy is tested.
    - jwt-generate
    - jwt-validate
    - oauth
    - throw
    - user-security
  4. Need to update APIC knowledge center on how to import LB API spec

@dhmlau
Copy link
Member Author

dhmlau commented Jan 21, 2020

Thanks @deepakrkris. I think we also need to have a docs task, possibly contribute back to the APIC's Knowledge Center, on how to import OpenAPI spec from LB.

@dhmlau
Copy link
Member Author

dhmlau commented Jan 22, 2020

From the above comments, I think you were able to import the OpenAPI spec generated by LoopBack into APIC.

What about "investigate if General limitations and Security limitations in APIC Knowledge Center would affect us"? Is it part of the task#2 you're proposing?

Additional spike necessary with LoopBack next authentication and authorization features.

@bajtos
Copy link
Member

bajtos commented Jan 23, 2020

Thank you @deepakrkris for documenting what you have found during the investigation 👍

Regarding the limitations described in #4115 (comment). IMO, we should not force APIC-specific constraints on all LoopBack users:

  • Since our current OpenAPI spec is valid, I think our users should have the option to keep using it as it is now.
  • At the same time, it would be great to have a (somewhat) automated solution for LB+APIC users, so that they don't have to apply all relevant changes themselves. Can we perhaps implement a new LB extension that will leverage OpenAPI spec enhancer introduced by @jannyHou to amend the spec produced by LoopBack to satisfy APIC requirements & constraints?

@deepakrkris
Copy link
Contributor

From the above comments, I think you were able to import the OpenAPI spec generated by LoopBack into APIC.

What about "investigate if General limitations and Security limitations in APIC Knowledge Center would affect us"? Is it part of the task#2 you're proposing?

Additional spike necessary with LoopBack next authentication and authorization features.

I will complete "investigate if General limitations and Security limitations in APIC Knowledge Center would affect us" as part of this spike.

@deepakrkris
Copy link
Contributor

Thank you @deepakrkris for documenting what you have found during the investigation 👍

Regarding the limitations described in #4115 (comment). IMO, we should not force APIC-specific constraints on all LoopBack users:

  • Since our current OpenAPI spec is valid, I think our users should have the option to keep using it as it is now.
  • At the same time, it would be great to have a (somewhat) automated solution for LB+APIC users, so that they don't have to apply all relevant changes themselves. Can we perhaps implement a new LB extension that will leverage OpenAPI spec enhancer introduced by @jannyHou to amend the spec produced by LoopBack to satisfy APIC requirements & constraints?

@bajtos , agree with you. I am thinking APIC toolkit should have an option to modify a spec to add x-ibm configurations and ask user to make necessary changes. I will create a task in velox-devops (APIC) repo and see what is the feedback.

@deepakrkris
Copy link
Contributor

From the above comments, I think you were able to import the OpenAPI spec generated by LoopBack into APIC.

What about "investigate if General limitations and Security limitations in APIC Knowledge Center would affect us"? Is it part of the task#2 you're proposing?

Additional spike necessary with LoopBack next authentication and authorization features.

@dhmlau I am reading thru the limitations. I will open few follow up tasks if any testing/verification is required. Otherwise this item will be completed as part of this spike.

@dhmlau
Copy link
Member Author

dhmlau commented Jan 23, 2020

@bajtos , agree with you. I am thinking APIC toolkit should have an option to modify a spec to add x-ibm configurations and ask user to make necessary changes. I will create a task in velox-devops (APIC) repo and see what is the feedback.

IIRC, for LoopBack 3, if you start off as a pure LB application, there's some CLI you can run to make it APIC compatible, i.e. adding the x-ibm-configuration. Maybe @jannyHou or @raymondfeng would know?

@jannyHou
Copy link
Contributor

jannyHou commented Jan 23, 2020

@dhmlau Hmm, I am not aware of those commands, at least LB3 doesn't have them (Maybe APIC has commands to import LB3 app?).
APIC generator creates .yaml file with swagger def and some APIC config file then invoke lb-cli to scaffold a new app, but for existing app, usually just copy the code over.
After the copy(or any change made to the apic app), there is a command called apic loopback:refresh to re-generate the .yaml file.

@deepakrkris
Copy link
Contributor

@dhmlau , @bajtos I have opened issue https://github.ibm.com/velox/velox/issues/4303 towards APIC platform (includes toolkit) . I will watch for feedback and update here.

@deepakrkris
Copy link
Contributor

updated the velox Epic for LoopBack 4 integration https://github.ibm.com/velox/ui/issues/19306

@bajtos
Copy link
Member

bajtos commented Jan 24, 2020

I am thinking APIC toolkit should have an option to modify a spec to add x-ibm configurations and ask user to make necessary changes. I will create a task in velox-devops (APIC) repo and see what is the feedback.

Sounds good to me 👍

@deepakrkris
Copy link
Contributor

I have gone thru the general limitations for Open API 3 in APIC Knowledge Center https://www.ibm.com/support/knowledgecenter/en/SSMNED_2018/com.ibm.apic.toolkit.doc/rapic_oai3_support.html . I don't see any case that would trigger incompatibility between APIC and LoopBack 4 APIs based on the given general and security limitations.
Most of those limitations are related to datapower's implementation of oauth security flows and available policies to configure in the API assembly palette. These don't affect the endpoints as such, regardless of if their implemented with LoopBack framework or not.

@deepakrkris
Copy link
Contributor

  1. Additional testing with other gateway policies (see : https://www.ibm.com/support/knowledgecenter/en/SSMNED_2018/com.ibm.apic.toolkit.doc/rapic_oai3_support.html). Currently only invoke policy is tested.
    • jwt-generate
    • jwt-validate
    • oauth
    • throw
    • user-security

This task is unnecessary as the available policies on the APIC assembly define the API invocation flow of datapower and has nothing to impact the endpoints themselves.

@deepakrkris
Copy link
Contributor

deepakrkris commented Jan 24, 2020

Follow up tasks:

  1. Issues raised on APIC toolkit : https://github.ibm.com/velox/platform/issues/1559 (APIC must support importing Open API spec from LoopBack and add additional extended configurations like x-ibm-configurations and generate product files)

  2. Test all endpoints in Shopping example with APIConnect ([Spike] End to End test Shopping example in cloud with APIConnect  #4498)

  3. Doc issue : Update APIC knowledge center on how to import LoopBack API spec, once the above two tasks are completed.

@dhmlau
Copy link
Member Author

dhmlau commented Jan 27, 2020

@deepakrkris, thanks for opening the follow up tasks. Can we close this issue as done? Thanks.

@deepakrkris
Copy link
Contributor

@dhmlau yes I am good with closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants