Skip to content

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

Closed
xavierhamel wants to merge 7 commits into
masterfrom
xh/feat/opapi-json-schema
Closed

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

Conversation

@xavierhamel

@xavierhamel xavierhamel commented Nov 14, 2025

Copy link
Copy Markdown
Contributor

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

linear Bot commented Nov 14, 2025

Copy link
Copy Markdown

@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.

2 participants