swagger-api/swagger-codegen

Generate .jmx (Jmeter file) from .yaml

Open

#8313 opened on Jun 13, 2018

View on GitHub
 (1 comment) (0 reactions) (0 assignees)HTML (12,701 stars) (5,474 forks)batch import
help wanted

Description

Hi everyone, I try to create my own template (api.mustache) in order to generate a .jmx (Jmeter test file) to test my API REST. My problem is to collect aproperties of a body type object parameter.

Here is a part of my .yaml :

/dossiers/{dossierId}/dossiers:
    post:
      tags:
      - DossierService
      summary: Ajouter un sous-dossier.
      operationId: addDossier
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: dossier
        in: body
        required: true
        schema:
          type: object
          required:
          - name
          properties:
            name:
              type: string
              maxLength: 200
              description: Le nom du nouveau dossier.

I want to extract the string "name" who is in properties of parameter "Dossier", but I can't do that...

When I use this code in my api.mustache, my variable {{basename}} is equal at "Dossier"...

{{#operations}}
{{#operation}}
{{#bodyParams}}
			   <elementProp name="{{baseName}}" elementType="HTTPArgument">
{{/bodyParams}}
{{/operation}}
{{/operations}}

I used DebugOperation et DebugModel to identify which variable I can use and i see my name variable in DebugModel but I can't use it (I tried use {{#models}}, {{#model}}, {{#var}}, etc...)

Somebody can help me ??

Mickael

Swagger-codegen version --> swagger-codegen-2.3.1

Contributor guide