Skip writing the HTTP actions to config file and log warning when RES…#1646
Merged
severussundar merged 1 commit intorelease/0.8from Aug 24, 2023
Conversation
…T Methods are configured for tables/views (#1607) - Closes #1571 #1570 - At the moment, CLI writes out all the 5 HTTP methods to the config file when adding an entity backed by table/view.  - However, for tables/views, the `Methods` property does not play any role and can be skipped writing to the config file. - `EntityRestOptions`: `Methods` property is made nullable. References where it was initialized with an empty array is updated to `null`. Appropriate `null` checks are added. - `EntityRestOptionsConverter`: Serialization logic is updated to write to the config file only when the `Methods` within REST element is not empty - `RuntimeConfigValidator.ValidatePresenceOfExtraRestProperties()`: Helper method to log a warning message when `Methods` property is added manually to an entity backed by table/view. - HTTP Actions are removed from the snapshot files. - `dab-config.*` files - `Methods` property is removed from the reference config files - [x] Integration Tests - [x] Unit Tests - [x] Manual Tests - CLI: REST actions are not written to the config file `dab add books --source books --permissions "anonymous:*"` Config Json created: ```json "entities": { "books": { "source": { "object": "books", "type": "table" }, "graphql": { "enabled": true, "type": { "singular": "books", "plural": "books" } }, "rest": { "enabled": true }, "permissions": [ { "role": "anonymous", "actions": [ { "action": "*" } ] } ] } } ``` - When the config file is hand-edited to add `methods` property to a table/view, engine logs a warning message during start-up Config: ```json "Book": { "source": { "object": "books", "type": "table" }, "rest": { "enabled": true, "methods": [ "get", "post" ] }, "graphql": { "enabled": true, "type": { "singular": "book", "plural": "books" } }, ``` Warning Logged: 
Aniruddh25
approved these changes
Aug 24, 2023
seantleonard
approved these changes
Aug 24, 2023
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.
release/0.8