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

Fix: schema spec #182

Merged
merged 3 commits into from
Mar 20, 2022
Merged

Fix: schema spec #182

merged 3 commits into from
Mar 20, 2022

Conversation

zhongwencool
Copy link
Contributor

  1. schema can define as :
#{roots => [{"val", hoconsc:map(key, string())}]},

the fields is not required.

  1. add ?R_REF/1 ?MK/1 ?MK/2 macro:
    we do a lot of import actions like:
-import(hoconsc, [mk/1, mk/2, ref/1, ref/2, array/1, enum/1]).

we can use macro to replace the import.

@@ -34,4 +35,8 @@
%% Map keys are always strings, `Name' is only for documentation
-define(MAP(Name, Type), {map, Name, Type}).

%% To avoid not import those function. we provide a macro to call them.
-define(MK(Type), hoconsc:mk(Type)).
-define(MK(Type, Meta), hoconsc:mk(Type, Meta)).
Copy link
Contributor

@terry-xiaoyu terry-xiaoyu Mar 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we reload all of modules rely on this header file, if it is changed and release upgrade is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need to change this macro anymore, we only change the function implementation hoconsc:mk/2. This macro is just a shortcut to a function, too simple to be modified in the future.
The only case I can think of where it might be modified is when hoconsc:mk/2 function is renamed. But we should add new function to do that instead of changing the name.

include/hoconsc.hrl Outdated Show resolved Hide resolved
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.

3 participants