I tried to deliver a series of our client’s CMS built on Elixir at the start of the my small group project, but we recently archived this open-source project and have yet to make plans to rework and expand it. After a long period, a series of macros and functional modules emerged from this project and our other projects, which we are gradually publishing in this library.
The creation of this macro will allow you to build normal/nested Structs that provide you with a number of important options, including the following:
- Validation
- Sanitizing
- Constructor
- It provides the capacity to operate in a nested style simultaneously.
This is the latest macro that I put in this library and it makes good features for you with the help of struct. Please click on the name of this macro to see different examples of it.
Creating basic CRUD; This macro needs to be rewritten and it is a simple macro that can be very useful to save your time.
I will gradually add some other modules and macros that may be useful to this post, please do not hesitate to give me your comments and suggestions.
Links
Hex: mishka_developer_tools | Hex
Documents: MishkaDeveloperTools — Mishka developer tools v0.1.9
Github: GitHub - mishka-group/mishka_developer_tools: Mishka developer tools provides some macros and modules to make creating your elixir application as easy as possible
2 Likes
The release of version 0.1.1 has taken place. In this edition, we will have a long list of additions, and we have also included a brand new module for access management.
We are delighted to introduce our new version of Mishka developer tools library. For more info click on GuardedStruct and PermissionAccess.
Changelog for MishkaDeveloperTools 0.1.1
- Add
derive for sanitizing and validating Either
- Add
derive for sanitizing and validating Enum, improved
- Add
derive for sanitizing and validating equal
- Add
exception when macro is configed for error: true, only can be called inside sub_field and guardedstruct macro
- Add
authorized_fields validating option for sub_field and guardedstruct macro
- Calling a struct from another module
- Calling list of structs from another module
- Add capability of having a
field with list of structs
- Add capability of having a
sub_field with list of structs
- Add Automatic generator for a specific key
on
- Add a dependent key to another key
auto
- Add a key to get a value from another key
from
- Add struct information function
- Add transmitting whole output of builder function to its children
- Add new style of builder entries to accept tuple with keys
- Add
auto, on, from core keys for list of structs
- Re-structured outputs for new capabilities with backward compatibility
- Add permission access module in runtime
Links
Github: Release 0.1.1 · mishka-group/mishka_developer_tools · GitHub
Hex: mishka_developer_tools | Hex
The release of version 0.1.2 has taken place. In this edition, we will have a long list of additions, and we have also included a brand macro for Conditional field structure.
Changelog for MishkaDeveloperTools 0.1.2
- Solving the problem of creating extra
atom in case of a mistake or an attack on the system. It could be a security issue, please update.
- Add allowed parent domain core key
Enum derive style
- Add allowed parent domain core key
either derive style
- Add allowed parent domain core key
equal derive style
- Add allowed parent domain core key
custom derive style
- Add driver for accepting
custom function
- Add status to auto core key if the data of key exists do not create auto value
- Add Conditional field structure
macro (Multiple states of a field) #21
- Add Supporting new
Typespecs for list(struct()) and previous one struct()
- Add Supporting new sanitizer for
:string_float
- Add Supporting new validation for
:string_float
- Add Supporting new validation for
:some_string_float
Links
Github: Release 0.1.2 · mishka-group/mishka_developer_tools · GitHub
Hex: mishka_developer_tools | Hex
We are delighted to introduce our new version (0.1.3) of Mishka developer tools library.
For more info click on GuardedStruct.
RoadMap 0.1.4: Predefined validations and sanitizers version 0.1.4 · Issue #8 · mishka-group/guarded_struct · GitHub
Changelog for MishkaDeveloperTools 0.1.3
Features:
- Support List
conditional_field
"actor": [
"http://joe.example.org",
{
"type": "Person",
"id": "http://sally.example.org",
"name": "Sally"
},
:test
]
- Covering
hint inside derive conditional_field and normal derive
- Support
domain key inside children fields
- Support new derives:
not_flatten_empty, not_flatten_empty_item as validation
- Support
not_empty and max_len, min_len for list in validation derive.
Fixed bugs:
- Fix and Remove
downcase bug in strip_tags
- Fix and Remove preventer of calling a
struct inside itself
- Fix domain core key to prevent it not to check domain when the key is
nil
Improvements:
- Changing the structure of on core key based on the value of the caller
- Support calling struct inside itself
- Separate all test of
GuardedStruct macro in different files
- Add
dialyzer for GuardedStruct macro
Github: Release 0.1.3 · mishka-group/mishka_developer_tools · GitHub
Hex: mishka_developer_tools | Hex
If you can contribute with me in this way, please contact me
1 Like
We are delighted to introduce our new version (0.1.4) of Mishka developer tools library. For more info click on GuardedStruct.

RoadMap 0.1.5: Predefined validations and sanitizers version 0.1.5 · Issue #27 · mishka-group/mishka_developer_tools · GitHub
Changelog for MishkaDeveloperTools 0.1.4
Features:
guardedstruct do
conditional_field(:actor, any()) do
field(:actor, struct(), struct: Actor, derive: "validate(map, not_empty)")
conditional_field(:actor, any(),
structs: true,
derive: "validate(list, not_empty, not_flatten_empty_item)"
) do
field(:actor, struct(), struct: Actor, derive: "validate(map, not_empty)")
field(:actor, String.t(), derive: "sanitize(tag=strip_tags) validate(url, max_len=160)")
end
field(:actor, String.t(), derive: "sanitize(tag=strip_tags) validate(url, max_len=160)")
end
end
Fixed bugs:
- Fix showing different errors when they accompany a conditional errors
- Fix short anonymous function warning in elixir 1.16
- Support pre-check derives inside conditional fields
- Normalize conditional fields errors
- Normalize validator errors
- Normalize errors
hint
- Normalize
derives errors
- Fix
dialyzer warning
- Support derive in normal conditional field without validator
conditional_field(:id, String.t()) do
field(:id, String.t(), derive: "sanitize(tag=strip_tags) validate(url, max_len=160)")
field(:id, any(), derive: "sanitize(tag=strip_tags) validate(not_empty_string, uuid)")
end
Docs

Github: Release 0.1.4 · mishka-group/mishka_developer_tools · GitHub
Hex: mishka_developer_tools | Hex
If you can contribute with me in this way, please contact me
1 Like
We are delighted to introduce our new version (0.1.5 ) of Mishka developer tools library.
The decision was made that this version will be a long-term version, and it will also include features that are several versions behind the existing version. However, because of the pressing issues with the builder’s loading speed and the solution to those issues, it was decided to release this version sooner with fewer features than it had originally planned.
Changelog for MishkaDeveloperTools 0.1.5
Features:
- Add
condition_field fields inside __information__ function
-
Inside module derive, in nested struct we can call from caller
- Add
uuid from ecto
- Add keys and enforce keys in
__information__ function
- Add some helpers like:
timestamp, validated_user? and validation username
Improvement:
- Speed problem in the derive section, and before this part of app V0.1.4, #30
- Fix performance issue inside sanitizer and validation, when we are using external
deps
- Fix
main_validator and halt the error when we have errors inside validator and not load main_validator
- Add some information and helper to be compatible for Mnesia (need more in the future)
- Fix bug and Add
NaiveDateTime, DateTime, Date struct to map parser
Extra
- Mnesia wrapper for Elixir, #28
- Add Erlang guard convertor for Elixir (simple helper function)
- Add
Mnesia pagination (infinite_scroll, numerical)
- Add some helper to work with
Mnesia data
RoadMap 0.1.6 : Predefined validations and sanitizers version 0.0.2 · Issue #4 · mishka-group/guarded_struct · GitHub
If you can contribute with me in this way, please contact me
Thank you in advance
We are delighted to introduce our new version (0.1.7 ) of Mishka developer tools library.
Kindly ensure that the macro is updated as quickly as feasible. This version includes a bug patch in the macro kernel that eliminates the issue of not being able to build in projects.
Changelog for MishkaDeveloperTools 0.1.7
In the past, it was possible to extend validation and sanitizer functions within the macro itself; however, this was a relatively insignificant addition that was ultimately overwritten. The same opportunity will now be available to you if you include environment in the project.
For example:
Application.put_env(:guarded_struct, :validate_derive, [TestValidate, TestValidate2])
Application.put_env(:guarded_struct, :sanitize_derive, [TestSanitize, TestSanitize2])
# OR
Application.put_env(:guarded_struct, :validate_derive, TestValidate)
Application.put_env(:guarded_struct, :sanitize_derive, TestSanitize)
I offer my heartfelt apologies for the occurrence of this bug and express my desire to encounter less similar challenges in the future.
Refs:
Based on Mix cannot build a macro library used in another library when macro is called more than once in project modules · Issue #13699 · elixir-lang/elixir · GitHub
Full Changelog: Comparing 0.1.6...0.1.7 · mishka-group/mishka_developer_tools · GitHub
Thank you in advance
We recently separated the GuardedStruct macro into a standalone library. Please visit its repository for more information.
The Mishka Developer Tools library became a place where I gradually added my helper tools, one of which was the GuardedStruct macro, which eventually became a fully independent and improved tool. I received two requests to separate this library, along with other reasons, such as deprecating many optional libraries that, if installed, provided an additional validation layer, like for location.
Now, all these optional libraries have been removed, and if you’d like to add custom validation, you can easily do so following the library’s documentation. Backward compatibility has also been fully considered, allowing you to use the package with ease.
Hex: guarded_struct | Hex
In the next version, I’ll publish a separate post for this library. If you were only using the GuardedStruct macro, you can remove Mishka Developer Tools and install the mentioned library instead.
Installation
def deps do
[
{:guarded_struct, "~> 0.0.1"}
]
end
1 Like