KaiZen-OpenAPI-Editor icon indicating copy to clipboard operation
KaiZen-OpenAPI-Editor copied to clipboard

Query parameter template includes default type integer/format int64

Open jfiala opened this issue 8 years ago • 5 comments

It would be better to have a more generic query parameter template (without the type) and then maybe offer types for integer/string etc. additionally? Currently each query parameter <> integer would have to be corrected (or add custom templates).

jfiala avatar Oct 24 '17 16:10 jfiala

OpenAPI v3

I do see an int64 type in the OAS3 header parameter template:

name: ${name}
in: header
description: ${ID}
required: true
schema:
  type: array
  items:
    type: ${integer}
    format: int64
style: commaDelimited

Swagger v2

We also use the int64 in the path, header, query, and form data parameter templates for Swagger v2.

This change is easy and I think it makes sense. @tedepstein , should we add this issue to the current sprint?

tfesenko avatar Oct 24 '17 23:10 tfesenko

Yes, I think the change makes sense. I've added it to the next sprint. To clarify scope:

  • ~Does it affect both OpenAPI v2 and v3?~ (already answered)
  • ~It affects both header and query parameter templates, but not path parameter templates, correct?~ (already answered)
  • Do we want to keep the format property in our template, but make the format value a template variable, so you can choose the value during template completion?

tedepstein avatar Oct 25 '17 01:10 tedepstein

I don't think this makes huge sense as for e.g. string this will be not needed. Better make a separate template for numeric types, where this makes sense?

BTW - the template idea & customization is great, I showed it at JCON here in Germany (http://jcon.one/de/) on Monday. It would be great to also have a property scope, to be able to add a prepared property template (rather than adding everything indiviually).

jfiala avatar Oct 26 '17 20:10 jfiala

Pls let me know if you want a PR or do everything on your own.

jfiala avatar Oct 26 '17 20:10 jfiala

@jfiala , thanks for the offer to submit a PR. We'd be very happy to have your contribution.

I don't think this makes huge sense as for e.g. string this will be not needed.

OpenAPI 3.0 defines formats for string, integer and number schemas.

OpenAPI 2.0 looks similar.

Better make a separate template for numeric types, where this makes sense?

If you wanted to make separate templates for the types that have formats, and one generic template for types without formats, I think that would be fine.

BTW - the template idea & customization is great, I showed it at JCON here in Germany (http://jcon.one/de/) on Monday.

Cool, thanks!

It would be great to also have a property scope, to be able to add a prepared property template (rather than adding everything indiviually).

We have started making some improvements in the way code assist works for properties.

The ideas are described here.

Initial Implementation is in this pull request, recently merged. I'm not sure if it's in our current release yet.

tedepstein avatar Oct 27 '17 13:10 tedepstein