Thanks Taher for the great proposal!

+1.

I tested Swagger OpenAPI editor[1], both 2.0 and 3.0.n regulations support 
multiple methods for one uri/path, here is my test code (yaml format):

openapi: "3.0.1"
info:
  title: OFBiz OpenAPI Test
  description: OFBiz OpenAPI Test
  version: 1.0.0

tags:
- name: "pet"
  description: "Everything about your Pets"
  externalDocs:
    description: "Find out more"
    url: "http://swagger.io";

paths:
  /webtools/control/pet:
    get:
      tags:
      - "pet"
      summary: "Add a new pet to the store"
      description: ""
      operationId: "addPet"
      parameters:
      - in: "query"
        name: "body"
        description: "Pet object that needs to be added to the store"
        required: true
        schema:
          $ref: "#/components/schemas/Pet"
      responses:
        405:
          description: "Invalid input"
    post:
      tags:
      - "pet"
      summary: "Update an existing pet"
      description: ""
      operationId: "updatePet"
      parameters:
      - in: "query"
        name: "body"
        description: "Pet object that needs to be added to the store"
        required: true
        schema:
          $ref: "#/components/schemas/Pet"
      responses:
        400:
          description: "Invalid ID supplied"
        404:
          description: "Pet not found"
        405:
          description: "Validation exception"

components:
  schemas:
    Category:
      type: "object"
      properties:
        id:
          type: "integer"
          format: "int64"
        name:
          type: "string"
      xml:
        name: "Category"
    Tag:
      type: "object"
      properties:
        id:
          type: "integer"
          format: "int64"
        name:
          type: "string"
      xml:
        name: "Tag"
    Pet:
      type: "object"
      required:
      - "name"
      - "photoUrls"
      properties:
        id:
          type: "integer"
          format: "int64"
        category:
          $ref: "#/components/schemas/Category"
        name:
          type: "string"
          example: "doggie"
        photoUrls:
          type: "array"
          xml:
            name: "photoUrl"
            wrapped: true
          items:
            type: "string"
        tags:
          type: "array"
          xml:
            name: "tag"
            wrapped: true
          items:
            $ref: "#/components/schemas/Tag"
        status:
          type: "string"
          description: "pet status in the store"
          enum:
          - "available"
          - "pending"
          - "sold"
          xml:
            name: "Pet"
externalDocs:
  description: "Find out more about Swagger"
  url: "http://swagger.io";

Kind Regards,

Shi Jinghai

[1] https://editor.swagger.io/

-----邮件原件-----
发件人: Taher Alkhateeb [mailto:slidingfilame...@gmail.com] 
发送时间: 2018年8月9日 23:31
收件人: OFBIZ Development Mailing List
主题: [Proposal] Enhance the controller logic to accommodate HTTP methods and 
prepare for REST

Hello Everyone,

We want to make this formal with proper community consensus and I will
try to keep this short.

In [1] Mathieu Lirzin is providing some (in my opinion) good work on
converting the Control Servlet logic to be able to handle the
different HTTP methods (GET, POST, etc ...) The purpose of the work in
this JIRA is simple. You should be able to call a request with a
different HTTP methods by using a format like <request-map uri="ping"
method="post">. You can find a more detailed discussion in [2]. This
is the first step of a multi-step process to be able to integrate REST
API with OFBiz.

So, this is a proposal to apply the following:
1- Enhance the controller to be able to accommodate one-or-more HTTP
methods (method="GET,POST")
2- Enhance the controller to further be able to get "patterns" that
can be mapped to REST APIs. So a request like
https://host/control/request/customer/orders/1/orderName can be
processed as a resource

Please correct me if I was wrong on anything written here Mathieu, and
please everyone provide your feedback if you approve of moving forward
with this initiative.

[1] https://issues.apache.org/jira/browse/OFBIZ-10438
[2] https://s.apache.org/ec2r

Reply via email to