You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/06/24 09:07:49 UTC

[GitHub] [apisix-dashboard] bzp2010 opened a new pull request, #2484: docs: add data loader and new OpenAPI 3 loader

bzp2010 opened a new pull request, #2484:
URL: https://github.com/apache/apisix-dashboard/pull/2484

   Please answer these questions before submitting a pull request, **or your PR will get closed**.
   
   **Why submit this pull request?**
   
   - [ ] Bugfix
   - [x] New feature provided
   - [x] Improve performance
   - [ ] Backport patches
   
   **What changes will this PR take into?**
   
   Add documentation for the data loader framework and the new OpenAPI3 import implementation.
   
   **Related issues**
   
   a part of #2465 
   
   **Checklist:**
   
   - [x] Did you explain what problem does this PR solve? Or what new features have been added?
   - [x] Have you added corresponding test cases?
   - [x] Have you modified the corresponding document?
   - [x] Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-dashboard] SylviaBABY commented on a diff in pull request #2484: docs: add data loader and new OpenAPI 3 loader

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #2484:
URL: https://github.com/apache/apisix-dashboard/pull/2484#discussion_r907063524


##########
docs/en/latest/modules/data_loader.md:
##########
@@ -0,0 +1,75 @@
+---
+title: Data Loader
+keywords:
+- APISIX
+- APISIX Dashboard
+- Data Loader
+- OpenAPI
+description: This document contains information about the Apache APISIX Dashboard data loader framework.
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+## What is Data Loader
+
+The data loader is an abstraction of the data import and export functionality under different specification definitions.
+
+Based on it, developers can easily implement the ability to export APISIX data entities to generate different data files, and parse the data files and convert them into APISIX data entities for import into APISIX.
+
+## Definition
+
+```go
+type Loader interface {
+    // Import accepts data and converts it into entity data sets
+    Import(input interface{}) (*DataSets, error)
+
+    // Export accepts entity data sets and converts it into a specific format
+    Export(data DataSets) (interface{}, error)
+}
+```
+
+Implement the above functions to complete the data conversion between Raw data format and DataSets data set, APISIX Dashboard will use DataSets data format as the intermediate format for importing and exporting according to it.
+
+Developers can look at the code in [api/internal/handler/data_loader/loader/loader.go](https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/data_loader/loader/loader.go) for the definition of the DataSets structure and the Data Loader interface.
+
+## Supported data loader
+
+- [OpenAPI 3](data_loader/openapi3.md): Currently only data import is supported
+
+## How to support other data loader
+
+Extending the data loader is simple and requires some development in the backend and frontend.
+
+### Implement data loader conversion logic (back-end)
+
+Create a structure that implements the above interface, which contains two parts.
+
+- Import function: complete the parsing and conversion from raw format `[]byte` uploaded by the user to DataSets structure [api/internal/handler/data_loader/loader/openapi3/import.go](https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/data_loader/loader/openapi3/import.go)
+- Export function: complete the generation of raw format for DataSets structure data inputted from APISIX Dashboard
+
+Adds a new item to the data loader list of the import and export handler.
+
+### Add front UI support for new data loader (front-end)
+
+Adds the previously created data loader to the frontend selector. [web/src/pages/Route/components/DataLoader/Import.tsx](https://github.com/apache/apisix-dashboard/blob/master/web/src/pages/Route/components/DataLoader/Import.tsx#L167-L172)

Review Comment:
   ```suggestion
   Adds the previously created data loader to the frontend selector.  Refer to [this]((https://github.com/apache/apisix-dashboard/blob/master/web/src/pages/Route/components/DataLoader/Import.tsx#L167-L172)) for more details.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-dashboard] bzp2010 commented on a diff in pull request #2484: docs: add data loader and new OpenAPI 3 loader

Posted by GitBox <gi...@apache.org>.
bzp2010 commented on code in PR #2484:
URL: https://github.com/apache/apisix-dashboard/pull/2484#discussion_r907078663


##########
docs/en/latest/modules/data_loader.md:
##########
@@ -0,0 +1,75 @@
+---
+title: Data Loader
+keywords:
+- APISIX
+- APISIX Dashboard
+- Data Loader
+- OpenAPI
+description: This document contains information about the Apache APISIX Dashboard data loader framework.
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+## What is Data Loader
+
+The data loader is an abstraction of the data import and export functionality under different specification definitions.
+
+Based on it, developers can easily implement the ability to export APISIX data entities to generate different data files, and parse the data files and convert them into APISIX data entities for import into APISIX.
+
+## Definition
+
+```go
+type Loader interface {
+    // Import accepts data and converts it into entity data sets
+    Import(input interface{}) (*DataSets, error)
+
+    // Export accepts entity data sets and converts it into a specific format
+    Export(data DataSets) (interface{}, error)
+}
+```
+
+Implement the above functions to complete the data conversion between Raw data format and DataSets data set, APISIX Dashboard will use DataSets data format as the intermediate format for importing and exporting according to it.
+
+Developers can look at the code in [api/internal/handler/data_loader/loader/loader.go](https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/data_loader/loader/loader.go) for the definition of the DataSets structure and the Data Loader interface.
+
+## Supported data loader
+
+- [OpenAPI 3](data_loader/openapi3.md): Currently only data import is supported
+
+## How to support other data loader
+
+Extending the data loader is simple and requires some development in the backend and frontend.
+
+### Implement data loader conversion logic (back-end)
+
+Create a structure that implements the above interface, which contains two parts.
+
+- Import function: complete the parsing and conversion from raw format `[]byte` uploaded by the user to DataSets structure [api/internal/handler/data_loader/loader/openapi3/import.go](https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/data_loader/loader/openapi3/import.go)
+- Export function: complete the generation of raw format for DataSets structure data inputted from APISIX Dashboard
+
+Adds a new item to the data loader list of the import and export handler.
+
+### Add front UI support for new data loader (front-end)
+
+Adds the previously created data loader to the frontend selector. [web/src/pages/Route/components/DataLoader/Import.tsx](https://github.com/apache/apisix-dashboard/blob/master/web/src/pages/Route/components/DataLoader/Import.tsx#L167-L172)
+
+:::note
+When you implement a data loader that requires partial input of custom parameters, you can create a form for it to enter data. [web/src/pages/Route/components/DataLoader/loader/OpenAPI3.tsx](https://github.com/apache/apisix-dashboard/blob/master/web/src/pages/Route/components/DataLoader/loader/OpenAPI3.tsx)

Review Comment:
   modified



##########
docs/en/latest/modules/data_loader/openapi3.md:
##########
@@ -0,0 +1,119 @@
+---
+title: OpenAPI 3
+keywords:
+- APISIX
+- APISIX Dashboard
+- Data Loader
+- OpenAPI
+description: This document contains information about the OpenAPI 3 data loader.
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+## Overview
+
+OpenAPI 3 data loader,It currently supports importing standard OpenAPI 3 documentation to generate individual paths as routes and upstreams in Apache APISIX.

Review Comment:
   modified



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-dashboard] SylviaBABY commented on a diff in pull request #2484: docs: add data loader and new OpenAPI 3 loader

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #2484:
URL: https://github.com/apache/apisix-dashboard/pull/2484#discussion_r907065088


##########
docs/en/latest/modules/data_loader/openapi3.md:
##########
@@ -0,0 +1,119 @@
+---
+title: OpenAPI 3
+keywords:
+- APISIX
+- APISIX Dashboard
+- Data Loader
+- OpenAPI
+description: This document contains information about the OpenAPI 3 data loader.
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+## Overview
+
+OpenAPI 3 data loader,It currently supports importing standard OpenAPI 3 documentation to generate individual paths as routes and upstreams in Apache APISIX.

Review Comment:
   ```suggestion
   OpenAPI 3 data loader currently supports importing standard OpenAPI 3 documentation to generate individual paths as routes and upstreams in Apache APISIX.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-dashboard] juzhiyuan merged pull request #2484: docs: add data loader and new OpenAPI 3 loader

Posted by GitBox <gi...@apache.org>.
juzhiyuan merged PR #2484:
URL: https://github.com/apache/apisix-dashboard/pull/2484


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-dashboard] bzp2010 commented on a diff in pull request #2484: docs: add data loader and new OpenAPI 3 loader

Posted by GitBox <gi...@apache.org>.
bzp2010 commented on code in PR #2484:
URL: https://github.com/apache/apisix-dashboard/pull/2484#discussion_r907078399


##########
docs/en/latest/modules/data_loader.md:
##########
@@ -0,0 +1,75 @@
+---
+title: Data Loader
+keywords:
+- APISIX
+- APISIX Dashboard
+- Data Loader
+- OpenAPI
+description: This document contains information about the Apache APISIX Dashboard data loader framework.
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+## What is Data Loader
+
+The data loader is an abstraction of the data import and export functionality under different specification definitions.
+
+Based on it, developers can easily implement the ability to export APISIX data entities to generate different data files, and parse the data files and convert them into APISIX data entities for import into APISIX.
+
+## Definition
+
+```go
+type Loader interface {
+    // Import accepts data and converts it into entity data sets
+    Import(input interface{}) (*DataSets, error)
+
+    // Export accepts entity data sets and converts it into a specific format
+    Export(data DataSets) (interface{}, error)
+}
+```
+
+Implement the above functions to complete the data conversion between Raw data format and DataSets data set, APISIX Dashboard will use DataSets data format as the intermediate format for importing and exporting according to it.
+
+Developers can look at the code in [api/internal/handler/data_loader/loader/loader.go](https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/data_loader/loader/loader.go) for the definition of the DataSets structure and the Data Loader interface.
+
+## Supported data loader
+
+- [OpenAPI 3](data_loader/openapi3.md): Currently only data import is supported
+
+## How to support other data loader
+
+Extending the data loader is simple and requires some development in the backend and frontend.
+
+### Implement data loader conversion logic (back-end)
+
+Create a structure that implements the above interface, which contains two parts.
+
+- Import function: complete the parsing and conversion from raw format `[]byte` uploaded by the user to DataSets structure [api/internal/handler/data_loader/loader/openapi3/import.go](https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/data_loader/loader/openapi3/import.go)
+- Export function: complete the generation of raw format for DataSets structure data inputted from APISIX Dashboard
+
+Adds a new item to the data loader list of the import and export handler.
+
+### Add front UI support for new data loader (front-end)
+
+Adds the previously created data loader to the frontend selector. [web/src/pages/Route/components/DataLoader/Import.tsx](https://github.com/apache/apisix-dashboard/blob/master/web/src/pages/Route/components/DataLoader/Import.tsx#L167-L172)

Review Comment:
   It looks like `(( ))` was repeated and I kept a `()`.



##########
docs/en/latest/modules/data_loader.md:
##########
@@ -0,0 +1,75 @@
+---
+title: Data Loader
+keywords:
+- APISIX
+- APISIX Dashboard
+- Data Loader
+- OpenAPI
+description: This document contains information about the Apache APISIX Dashboard data loader framework.
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+## What is Data Loader
+
+The data loader is an abstraction of the data import and export functionality under different specification definitions.
+
+Based on it, developers can easily implement the ability to export APISIX data entities to generate different data files, and parse the data files and convert them into APISIX data entities for import into APISIX.
+
+## Definition
+
+```go
+type Loader interface {
+    // Import accepts data and converts it into entity data sets
+    Import(input interface{}) (*DataSets, error)
+
+    // Export accepts entity data sets and converts it into a specific format
+    Export(data DataSets) (interface{}, error)
+}
+```
+
+Implement the above functions to complete the data conversion between Raw data format and DataSets data set, APISIX Dashboard will use DataSets data format as the intermediate format for importing and exporting according to it.
+
+Developers can look at the code in [api/internal/handler/data_loader/loader/loader.go](https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/data_loader/loader/loader.go) for the definition of the DataSets structure and the Data Loader interface.
+
+## Supported data loader
+
+- [OpenAPI 3](data_loader/openapi3.md): Currently only data import is supported
+
+## How to support other data loader
+
+Extending the data loader is simple and requires some development in the backend and frontend.
+
+### Implement data loader conversion logic (back-end)
+
+Create a structure that implements the above interface, which contains two parts.
+
+- Import function: complete the parsing and conversion from raw format `[]byte` uploaded by the user to DataSets structure [api/internal/handler/data_loader/loader/openapi3/import.go](https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/data_loader/loader/openapi3/import.go)
+- Export function: complete the generation of raw format for DataSets structure data inputted from APISIX Dashboard
+
+Adds a new item to the data loader list of the import and export handler.
+
+### Add front UI support for new data loader (front-end)
+
+Adds the previously created data loader to the frontend selector. [web/src/pages/Route/components/DataLoader/Import.tsx](https://github.com/apache/apisix-dashboard/blob/master/web/src/pages/Route/components/DataLoader/Import.tsx#L167-L172)

Review Comment:
   modified



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-dashboard] SylviaBABY commented on a diff in pull request #2484: docs: add data loader and new OpenAPI 3 loader

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #2484:
URL: https://github.com/apache/apisix-dashboard/pull/2484#discussion_r907064186


##########
docs/en/latest/modules/data_loader.md:
##########
@@ -0,0 +1,75 @@
+---
+title: Data Loader
+keywords:
+- APISIX
+- APISIX Dashboard
+- Data Loader
+- OpenAPI
+description: This document contains information about the Apache APISIX Dashboard data loader framework.
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+## What is Data Loader
+
+The data loader is an abstraction of the data import and export functionality under different specification definitions.
+
+Based on it, developers can easily implement the ability to export APISIX data entities to generate different data files, and parse the data files and convert them into APISIX data entities for import into APISIX.
+
+## Definition
+
+```go
+type Loader interface {
+    // Import accepts data and converts it into entity data sets
+    Import(input interface{}) (*DataSets, error)
+
+    // Export accepts entity data sets and converts it into a specific format
+    Export(data DataSets) (interface{}, error)
+}
+```
+
+Implement the above functions to complete the data conversion between Raw data format and DataSets data set, APISIX Dashboard will use DataSets data format as the intermediate format for importing and exporting according to it.
+
+Developers can look at the code in [api/internal/handler/data_loader/loader/loader.go](https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/data_loader/loader/loader.go) for the definition of the DataSets structure and the Data Loader interface.
+
+## Supported data loader
+
+- [OpenAPI 3](data_loader/openapi3.md): Currently only data import is supported
+
+## How to support other data loader
+
+Extending the data loader is simple and requires some development in the backend and frontend.
+
+### Implement data loader conversion logic (back-end)
+
+Create a structure that implements the above interface, which contains two parts.
+
+- Import function: complete the parsing and conversion from raw format `[]byte` uploaded by the user to DataSets structure [api/internal/handler/data_loader/loader/openapi3/import.go](https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/data_loader/loader/openapi3/import.go)
+- Export function: complete the generation of raw format for DataSets structure data inputted from APISIX Dashboard
+
+Adds a new item to the data loader list of the import and export handler.
+
+### Add front UI support for new data loader (front-end)
+
+Adds the previously created data loader to the frontend selector. [web/src/pages/Route/components/DataLoader/Import.tsx](https://github.com/apache/apisix-dashboard/blob/master/web/src/pages/Route/components/DataLoader/Import.tsx#L167-L172)
+
+:::note
+When you implement a data loader that requires partial input of custom parameters, you can create a form for it to enter data. [web/src/pages/Route/components/DataLoader/loader/OpenAPI3.tsx](https://github.com/apache/apisix-dashboard/blob/master/web/src/pages/Route/components/DataLoader/loader/OpenAPI3.tsx)

Review Comment:
   ```suggestion
   When you implement a data loader that requires partial input of custom parameters, you can create a form for it to enter data. Refer to [this](https://github.com/apache/apisix-dashboard/blob/master/web/src/pages/Route/components/DataLoader/loader/OpenAPI3.tsx) for more details.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org