-
Notifications
You must be signed in to change notification settings - Fork 24
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
Support Unknown Type #429
Comments
Hmmm.. need to think on this one. There's also the concept of an AnyType, which is semantically slightly different, but is more in line with what most type systems have. @mjperrone can you give a concrete example or two of real situations where Recap can't model the type? I think I need to understand more about the use case. Curious if @cpard has any thoughts? |
I can't think of any database types that can't be represented in recap. The only context I can imagine a type that Recap can't represent is Unknown in the TypeScript type system. I don't think that's a compelling reason to add I think the best reason would be:
to allow recap to be useful when the converters are only partially implemented. |
This is the biggest use case I see as well. Right now many of the converters raise an error when they encounter a type they don't yet support (example from the JSONSchemaConverter). Given a large/complex JSON schema, a single use of an unsupported type prevents the remainder of the schema from being converted. I think it could be useful for converters to have an option to be less strict, in which case the supported schema is converted, any anything else is typed as Another option would be to just drop anything that can't be converted, but from a user experience perspective I think getting back an |
Gotcha, this totally makes sense as a use case. I'm thinking through implementation approaches. I am hesitant to modify the type system for this; it feels more like a valid concern about the way converters are implemented. I think what we want is some kind of
Any other ideas? (1) is least invasive, but maybe a bit of an abuse of RecapType. It is actually more like AnyType right now. (2) is most semantically correct. We do have some precedent for this style with (3) seems the most invasive and also a bit of an abuse of (4) also seems a bit funky to me since null is an actual type that can be expressed in many other type systems. It's also something we support in the CST. For (2), can you guys think of precedent in other schema systems for this kind of model? I'd like to see what others do for this use case. Zed has the concept of an error type; this seems close. Regardless of what we pick, we probably also want to propagate as much information about the underlying type as possible, such as the underlying type as a string, docs, etc. |
@mjperrone @adrianisk K, let's move forward by adding UnknownType in types.py. The converters should all be updated to return UnknownType instead of raising an exception. I think we can skip the Pull request welcome. ;) |
#430 Still needs some work but here's a start |
There may be situations where there is a field that cannot be understood by the recap converters, or cannot be represented in Recap, or based on the particular source system the type simply is not determinable.
In such cases, it could be valuable to allow some kind of placeholder that acknowledges that the field/column exists by name, but without trying to represent the schema of that field. Adding an
UnknownType
to recap could do that.Potential implementation:
The text was updated successfully, but these errors were encountered: