question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide mechanisms for users to register own types and format

See original GitHub issue

As discussed in the latest hangout (and related to https://github.com/smallrye/smallrye-open-api/issues/147)

It would be useful to have a mechanism that allows users to:

For example, this could be as simple as: mp.openapi.extensions.type-format.FQCN=SchemaType,DataFormat

So you could map your custom date type to the correct SchemaType and DataFormat.

  • As suggested by @EricWittmann in the the meeting was that we may also want to consider a more advanced mechanism that allows a schema to be mapped to a particular object (i.e. for cases where it’s not simply about primitives). Eric mentioned the recent SmallRye Custom Schema Registry (https://github.com/smallrye/smallrye-open-api/pull/126/files) as a possible model.

  • I suggested that (in addition to config-driven), a programmatic interface might be beneficial, in allowing runtimes to inject certain mapping information they already know about (e.g. for some type that a framework commonly provides).

There are some parallels here with the way that Jackson works – they have a large number of converters OOTB that take (e.g. Map, Simple Java Bean, List, Date) and convert it into something sensible in JSON. However, if you provide your own complex data structure you need to provide your own converter and/or mapping.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
MikeEdgarcommented, Dec 20, 2019

The changes for this are complete, with one idea we had not discussed yet. If a user provides a "name" property in the config JSON, the implementations should place the schema under components.schemas using the value of "name" property as the schema’s key. This would provide a portable way for users to use a $ref to a schema defined in the config file.

If there is no negative feedback on that point, I’ll open the PR.

1reaction
MikeEdgarcommented, Dec 3, 2019

If everyone is in agreement with the latest part of the discussion, I can work on updating the spec document and adding a test.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Entity Forms on the Example of User Editing and ...
In this article, I will tell you how to register and display custom modes for displaying entity forms in Drupal, and how it...
Read more >
How to Allow User Registration on Your WordPress Site
You need to provide a name for your custom login form and then select 'User Login Form' as your template. WPForms will now...
Read more >
User Management in 2022 and Beyond: A Complete Guide
Providing a convenient login mechanism for end-users; Allowing users to set and reset passwords; Enabling multi-factor authentication (MFA) ...
Read more >
RegistrationMagic – Custom Registration Forms, User ...
Create customized user registration forms, accept payments, track submissions, manage users, analyze stats, assign user roles and more!
Read more >
Forms in HTML documents - W3C
Authors may create two types of controls that allow users to input text. The INPUT element creates a single-line input control and the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found