Skip to content

feat(opapi): Support JSON schemas as input#660

Draft
xavierhamel wants to merge 7 commits intomasterfrom
xh/feat/opapi-json-schema
Draft

feat(opapi): Support JSON schemas as input#660
xavierhamel wants to merge 7 commits intomasterfrom
xh/feat/opapi-json-schema

Conversation

@xavierhamel
Copy link
Contributor

@xavierhamel xavierhamel commented Nov 14, 2025

Resolves KKN-290

Non-breaking proposition to support JSON Schemas.

This is now supported:

const api = new OpenApi({
  metadata: {
    title: 'Test',
    server: 'http://localhost:8080',
    version: '1.0.0',
    description: 'Description'
  },
  schemas: {
    user: {
      section: 'User',
      schema: {
        properties: {
          name: { type: 'string' },
          email: { type: 'string' },
        }
      }
    }
  }
})

api.addOperation({
  name: 'allo',
  path: '/allo',
  description: 'Ceci est une description',
  method: 'post',
  parameters: {
    'test': {
      required: true,
      description: 'Test param',
      type: 'object',
      in: 'query',
      schema: {
        properties: {
          id: {
            type: 'string',
          }
        }
      }
    }
  },
  requestBody: {
    description: 'allo',
    schema: {
      properties: {
        id: {
          type: 'string',
        }
      }
    }
  },
  response: {
    status: 200,
    description: 'Allo',
    schema: {
      properties: {
        user: api.getModelRef('user')
      }
    }
  }
})

api.exportOpenapi('./gen/')

@xavierhamel xavierhamel requested review from a team as code owners November 14, 2025 15:26
@linear
Copy link

linear bot commented Nov 14, 2025

@xavierhamel xavierhamel marked this pull request as draft November 14, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant