Fork me on GitHub
#reitit
<
2021-07-22
>
slipset08:07:32

Reitit and Swagger: So my route definition generates the following swagger:

'/api/workspacefolder/{id}':
    get:
      responses:
        default:
          description: ''
      parameters:
        - in: path
          name: id
          description: ''
          type: null
          required: true
      summary: Get a workspacefolder
      tags:
        - Workspacefolder API
    put:
      responses:
        default:
          description: ''
      parameters:
        - in: path
          name: id
          description: ''
          type: null
          required: true
        - in: body
          name: ardoq.specs/non-empty-request-body
          description: ''
          required: true
          schema:
            title: ardoq.specs/non-empty-request-body
      summary: Update a workspacefolder
      tags:
        - Workspacefolder API
This is marked as invalid by https://editor.swagger.io, and I believe it’s because the type is null. The spec that is used to descript the id parameter is the following:
(s/def ::_id (s/with-gen
               (spec-tools/spec object-id? {:type :object-id})
               #(gen/fmap id (tgen/large-integer* {:min (coerce/to-long (t/now))}))))
And I believe the reason we do get the null type is that no-one knows what an :object-id is. Is there a way to inform the reitit swagger generation to do something smarter here?