Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

Enable request body for DELETE requests #702

@mikand13

Description

@mikand13

Is your feature request related to a problem? Please describe.
Inconvenience when generating from openapi.json because we have a single request that needs some input for a delete. Seeing as the spec allows a body, shouldnt kompendium too?

Describe the solution you'd like

package io.bkbn.kompendium.core.metadata

import com.sun.beans.introspect.PropertyInfo.Name.description
import io.bkbn.kompendium.oas.common.ExternalDocumentation
import io.bkbn.kompendium.oas.payload.Parameter
import jdk.internal.net.http.common.Log.errors
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle.summary

class DeleteInfo private constructor(
  override val request: RequestInfo?,
  override val response: ResponseInfo,
  override val errors: MutableList<ResponseInfo>,
  override val tags: Set<String>,
  override val summary: String,
  override val description: String,
  override val externalDocumentation: ExternalDocumentation?,
  override val security: Map<String, List<String>>?,
  override val operationId: String?,
  override val deprecated: Boolean,
  override val parameters: List<Parameter>
) : MethodInfoWithRequest {

  companion object {
    fun builder(init: Builder.() -> Unit): DeleteInfo {
      val builder = Builder()
      builder.init()
      return builder.build()
    }
  }

  class Builder : MethodInfoWithRequest.Builder<DeleteInfo>() {
    override fun build() = DeleteInfo(
      request = request,
      response = response ?: error("Response info must be present"),
      errors = errors,
      tags = tags,
      summary = summary ?: error("Summary must be present"),
      description = description ?: error("Description must be present"),
      externalDocumentation = externalDocumentation,
      operationId = operationId,
      deprecated = deprecated,
      parameters = parameters,
      security = security
    )
  }
}

Describe alternatives you've considered
Writing the data class ourselves, after generation of everything else.

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions