Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding in RequestBody: properly support encoding in "RequestBody" #1159

Open
excavador opened this issue Jan 15, 2024 · 0 comments
Open

encoding in RequestBody: properly support encoding in "RequestBody" #1159

excavador opened this issue Jan 15, 2024 · 0 comments
Labels
enhancement New feature or request openapi-features OpenAPI features support issues

Comments

@excavador
Copy link

excavador commented Jan 15, 2024

I would like to describe RequestBody for multipart/form-data content-type with encoding to particular fields

Description

The multipart/form-data content-type allows you to describe "contentType" for individual fields.
Right now I am receiving the problem like the following:

Feature "form content encoding" is not implemented yet.
Try to create ogen.yml with:

generator:
	ignore_not_implemented: "form content encoding"

or

generator:
	ignore_not_implemented: ["all"]

to skip unsupported operations.

generation failed:
    main.run
        /home/oleg/go/pkg/mod/github.com/ogen-go/ogen@v0.81.1/cmd/ogen/main.go:308
exit status 1
make: *** [Makefile:80: api/client/example/ogen/oas_client_gen.go] Error 1

for the following RequestBody

  requestBodies:
    PetCreate:
      content:
        multipart/form-data:
          encoding:
            document:
              contentType: application/vc+ld+json
            pet:
              contentType: application/json
            tags:
              contentType: application/json
          schema:
            $ref: '#/components/schemas/PetCreate'
      required: true
    PetUpdate:
      content:
        multipart/form-data:
          encoding:
            document:
              contentType: application/vc+ld+json
            pet:
              contentType: application/json
            tags:
              contentType: application/json
          schema:
            $ref: '#/components/schemas/PetUpdate'
      required: true
  schemas:
    PetCreate:
      type: object
      description: Schema for create pet's resource.
      required:
        - tags
        - document
        - pet
      properties:
        tags:
          $ref: #/components/schemas/Tags
        document:
          type: string
          format: binary
          description: Schema for document linked to pet's resource.
        pet:
          $ref: '#/components/schemas/Pet'
    PetDocument:
      type: string
      format: binary
      description: Schema for document linked to pet's resource.
    TagKey:
      type: string
      description: Key of tag of resource.
    TagValue:
      type: string
      description: Value of the tag of the resource.
    Tags:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/TagValue'
    Pet:
      type: object
      description: A pet.
      required:
        - nickname
        - issued
      properties:
        nickname:
          type: string
          description: Nickname of a pet.
        issued:
          type: string
          format: date
          description: Issuance date.
          readOnly: true

in the config file I specified the following

generator:
  content_type_aliases:
    application/problem+json: application/json
    application/vc+ld+json:   application/octet-stream

References

OpenAPI v3.0.3 specification - Encoding Object

@excavador excavador added enhancement New feature or request openapi-features OpenAPI features support issues labels Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request openapi-features OpenAPI features support issues
Projects
None yet
Development

No branches or pull requests

1 participant