swagger-api / swagger-api/swagger-codegen

Generate .jmx (Jmeter file) from .yaml

Open
#8,313 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with api.mustache and the DebugOperation and DebugModel output mentioned in the issue. Trace how bodyParams exposes the body schema's properties, then verify that generating the JMX file includes the name property from the YAML body parameter.

Written by the indexing model from the issue text.

Assessment

Domain
testing-qa, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.