Replace manual ParseDocument implementations with derive macro#70
Merged
Replace manual ParseDocument implementations with derive macro#70
Conversation
- Add #[eure(allow_unknown_fields)] container and variant attributes to eure-macros - Replace manual ParseDocument implementations in eure-codegen (5 types): RootCodegen, CodegenDefaults, UnionCodegen, RecordCodegen, FieldCodegen - Replace manual ParseDocument implementations in eure-config (3 types): Target, CliConfig, LsConfig - Replace manual ParseDocument implementation in eure-schema: Description enum now uses derive with rename_all = "lowercase" - Add tests for allow_unknown_fields attribute on both structs and enum variants
…vert phase - Add ParseDocument impl for regex::Regex in eure-document using existing InvalidPattern error variant - Create ParsedTextSchema in eure-schema with derive macro, using pattern: Option<String> instead of compiled Regex - Move regex compilation from parse phase to convert phase (convert_text_schema) - Add #[eure(allow_unknown_extensions)] attribute to derive macro for types that don't handle extensions themselves (extensions are handled at a higher level like ParsedSchemaNode) - Add InvalidRegexPattern variant to ConversionError for regex compilation errors
Change InvalidPattern from {pattern, value} to {kind, reason} fields:
- kind: Type of validation (e.g., "regex", "url", "uuid", "type reference")
- reason: Human-readable error message explaining the failure
This makes the error variant suitable for future URL, UUID, and other
validation types that can be added with optional features.
Since Regex implements ParseDocument, Option<Regex> works automatically. This simplifies the code by: - Adding derive macro to TextSchema in lib.rs - Removing intermediate ParsedTextSchema in parse.rs - Removing convert_text_schema and InvalidRegexPattern in convert.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RootCodegen, CodegenDefaults, UnionCodegen, RecordCodegen, FieldCodegen
Target, CliConfig, LsConfig
Description enum now uses derive with rename_all = "lowercase"