SeUniVr / RestTestGen

A framework for automated black-box testing of RESTful APIs.
Apache License 2.0
36 stars 9 forks source link

RestTestGen can not parse API document, #2

Closed jiaxian-lin closed 1 year ago

jiaxian-lin commented 2 years ago

when I run RestTestGen in ubuntu, I got this ERROR, I don't know why and this open API file is converted by Swagger Editor image

this is a part of my API file:

/projects/{id}/fork:
  post:
      tags:
        - projects-api
      parameters:
        - name: id
          schema:
            type: integer
          required: true
          in: path
          description: The ID or URL-encoded path of the project.
        - name: path
          schema:
            type: string
          in: query
          required: true
        - name: name
          schema:
            type: string
          in: query
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: The name assigned to the resultant project after forking.
                namespace_id:
                  type: integer
                  description: The ID of the namespace that the project is forked to.
                namespace_path:
                  type: string
                  description: The path of the namespace that the project is forked to.
                namespace:
                  oneOf:
                    - type: integer
                    - type: string
                  description:
                    (Deprecated) The ID or path of the namespace that the
                    project is forked to.
                path:
                  type: string
                  description: The path assigned to the resultant project after forking.
      responses:
        '200':
          description: success

This document is handwritten, can you explain what formats RestTestGen can parse?

davidecorradini commented 2 years ago

Hello, this does not seem a problem with the parsing of the specification, but with the handling of a parsed Operation object. The Operation objects parsed from the specification are read-only, and they need to be cloned in order to be manipulated. If you try to edit a read-only Operation object, you will get that error. Are you implementing a custom strategy or customizing an existing strategy? In that case, when you need to manipulate an Operation object, you first need to get a clone of it with .deepClone(), e.g., Operation myClonedAndEditableOperation = parsedOperation.deepClone();

If this is not the case, it could be a bug on our side. Could you please provide the full OpenAPI specification, so I can try to run RTG on my machine? Thanks.

Davide

davidecorradini commented 1 year ago

Closing this issue because no futher information about the problem has been provided.