opened
atamboli
username_0
We are using the zap-api-scan.py to run automated scan.
Until last week the script was parsing the api-docs.json using a URL correctly. 
The api-docs.json got udpated today and the script is throwing an error since then.

Below is the error thrown:
```
[ZAP-Import-OpenAPI-7] WARN org.zaproxy.zap.extension.openapi.ExtensionOpenApi  - 
java.lang.NullPointerException
    at org.zaproxy.zap.model.DefaultValueGenerator.getValue(DefaultValueGenerator.java:90)
    at org.zaproxy.zap.extension.openapi.generators.ValueGenerator.getValue(ValueGenerator.java:53)
    at org.zaproxy.zap.extension.openapi.generators.DataGenerator.generateExampleValueForPath(DataGenerator.java:181)
    at org.zaproxy.zap.extension.openapi.generators.DataGenerator.getExampleValue(DataGenerator.java:165)
    at org.zaproxy.zap.extension.openapi.generators.DataGenerator.generateParam(DataGenerator.java:94)
    at org.zaproxy.zap.extension.openapi.generators.DataGenerator.generate(DataGenerator.java:65)
    at org.zaproxy.zap.extension.openapi.generators.PathGenerator.generateFullPath(PathGenerator.java:56)
    at org.zaproxy.zap.extension.openapi.converter.swagger.RequestModelConverter.generatePath(RequestModelConverter.java:63)
    at org.zaproxy.zap.extension.openapi.converter.swagger.RequestModelConverter.convert(RequestModelConverter.java:48)
    at org.zaproxy.zap.extension.openapi.converter.swagger.SwaggerConverter.convertToRequest(SwaggerConverter.java:75)
    at org.zaproxy.zap.extension.openapi.converter.swagger.SwaggerConverter.getRequestModels(SwaggerConverter.java:69)
    at org.zaproxy.zap.extension.openapi.ExtensionOpenApi$3.run(ExtensionOpenApi.java:212)
```
Can someone please let me know what could go wrong?
The only change in the new json file is the addition of the header fields in the parameter object as below - 
 ```
 "parameters": [
                    {
                        "in": "header",
                        "name": "request-id",
                        "required": false,
                        "type": "string"
                    },
                    {
                        "in": "header",
                        "name": "session-id",
                        "required": false,
                        "type": "string"
                    },
]
```
Error parsing the api-docs.json
issue
created
thc202
username_1
This seems to be caused by a bug in the OpenAPI add-on.

Which ZAP version (or Docker image) are you using?
comment
created
atamboli
username_0
zap2docker-weekly..
Is there any workaround? What is the exact issue in openapi addon?
comment
created
thc202
username_1
Could you provide the ID of the image? Is that the latest (`40276f9ef1fb`)?

I'm not aware of a workaround (yet, not able to reproduce the issue). Based on the stack trace one of the parameters does not have a type (or if it has one it's being lost).

Could you also provide the path where those parameters are? (The path can be obfuscated just to want to try reproduce that locally.)
comment
created
atamboli
username_0
Yes we are using the latest image - 40276f9ef1fb
Looks like ZAP can’t handle MAP<String, String>, and I change it to plain String.
comment
created
thc202
username_1
OK, no worries, thanks for the info!
comment
created
atamboli
username_0
Thanks @username_1  for the help. I am closing the issue.
comment
closed
atamboli
username_0
issue