dredd icon indicating copy to clipboard operation
dredd copied to clipboard

Body request not generated when format is uuid

Open juliengerboud opened this issue 8 years ago • 5 comments

Describe your problem

The request body is not generated when format: uuid is present and there is no error message as of why. Thanks for your help! Output without format: uuid (commented out):

request: 
method: POST
uri: /users
headers: 
    Content-Type: application/json
    Accept: application/json
    User-Agent: Dredd/4.9.1 (Linux 4.4.0-104-generic; x64)
    Authorization:  Bearer eyJhb...
    Content-Length: 71

body: 
{
  "id": "8c42b07b-ce44-2572-349b-e9e8bb13a58c",
  "name": "aliquip"
}

Output with format: uuid:

request: 
method: POST
uri: /users
headers: 
    Content-Type: application/json
    Accept: application/json
    User-Agent: Dredd/4.9.1 (Linux 4.4.0-104-generic; x64)
    Authorization:  Bearer eyJhb...
    Content-Length: 0

body: 




Swagger definition (format properties is on line 46)

swagger: '2.0'
info:
  version: "0.0.1"
  title: "dredd test"
host: localhost:5004
basePath: /
consumes:
  - application/json
produces:
  - application/json
paths:

  /users:
    post:
      operationId: testId
      tags:
        - testTag
      parameters:
        - $ref: '#/parameters/testBody'
      responses:
        201:
          description: An object
          schema:
            type: object
            properties:
              id:
                type: integer
                description: an id.
parameters:
  testBody:
    name: testBody
    in: body
    required: true
    schema:
      $ref: '#/definitions/TestDefinitionBody'

definitions:
  TestDefinitionBody:
    type: object
    title: TestDefinitionBody
    required:
      - id
    properties:
      id:
        type: string
        format: uuid
        pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'
        example: 3a336874-af17-4870-937d-0afb14e996ef
      name:
        type: string
        minLength: 1
        maxLength: 100
        example: 'Just a name'

What command line options do you use?

$ dredd --config dredd.yml --header "Authorization: Bearer <?>

What is in your dredd.yml?

dry-run: null
hookfiles: []
language: nodejs
sandbox: false
server: null
server-wait: 3
init: false
custom: {}
names: false
only: []
reporter: [html]
output: [Report.html]
header: []
sorted: false
user: null
inline-errors: false
details: false
method: []
color: true
level: info
timestamp: false
silent: false
path: []
hooks-worker-timeout: 5000
hooks-worker-connect-timeout: 1500
hooks-worker-connect-retry: 500
hooks-worker-after-connect-wait: 100
hooks-worker-term-timeout: 5000
hooks-worker-term-retry: 500
hooks-worker-handler-host: 127.0.0.1
hooks-worker-handler-port: 61321
config: ./dredd.yml
blueprint: ./test-api.yaml
endpoint: http://172.18.0.1:8080

What's your dredd --version output?

dredd v4.9.1 (Linux 4.4.0-104-generic; x64)

Does dredd --level=debug uncover something?

Nope...

Can you send us failing test in a Pull Request?

Not sure it would help since the pb is on the request generation.

juliengerboud avatar Dec 20 '17 16:12 juliengerboud

@honzajavorek Sorry to ping you like that... Would it be possible to have some insights? Thanks for your help!

juliengerboud avatar Jan 09 '18 08:01 juliengerboud

@juliengerboud Hi, I'm sorry! This had to slip through our radars, somehow. Let us check what could be the issue.

honzajavorek avatar Jan 09 '18 14:01 honzajavorek

So the issue can be either in the Swagger adapter (cc @kylef) or in Dredd. We need to figure out that one first. Also, I'm wondering whether https://github.com/apiaryio/fury-adapter-swagger/issues/99 isn't related to this, somehow.

honzajavorek avatar Jan 09 '18 14:01 honzajavorek

@juliengerboud This problem should be fixed in Dredd 4.9.3, could you give it a go and confirm the fix is working for you please.

kylef avatar Jan 18 '18 19:01 kylef

It does! Thanks a lot @kylef @honzajavorek

juliengerboud avatar Jan 19 '18 15:01 juliengerboud