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

feat: Expose typedef edit actions in OpenAPI #949

Merged
merged 16 commits into from
May 31, 2023
Merged

Commits on May 30, 2023

  1. fix: Avoid long IDs for nodes in type of primitive def

    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    9078305 View commit details
    Browse the repository at this point in the history
  2. refactor: Move selection types to App.Base

    This will be necessary in order to make use of them in actions-related modules.
    
    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    b127690 View commit details
    Browse the repository at this point in the history
  3. refactor: Parameterise selection types

    We parameterise this way, rather than parameterising `ExprMeta` and `TypeMeta` separately, since we otherwise wouldn't be able to reconstruct even a basic `Selection' ID` from the OpenAPI API, without clients knowing whether a particular ID corresponds to a type or term. We want clients to be able to be dumber than that.
    
    Note that, for `Selection`, we use a synonym for the non-parameterised version, but not for `NodeSelection`, and we will not in future for `DefSelection` and `TypeDefSelection`. That's because this synonym is actually widely useful, and we use it in several modules to make things more readable. With `NodeSelection` etc. we never really require such a synonym, and we avoid it because of all the ceremony it would add, particularly around imports.
    
    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    2a8f645 View commit details
    Browse the repository at this point in the history
  4. refactor!: Rename selection fields

    This will significantly decrease the amount of breakage when we unify our selection types.
    
    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    47a4c1c View commit details
    Browse the repository at this point in the history
  5. refactor!: Don't use API-specific selection types

    This removes some boilerplate where we converted between types which are essentially the same. That boilerplate would have become much bigger once we extend selections to cover type definitions.
    
    Despite the previous commit, there is one small breaking change, seen in `openapi.json` (`meta` instead of `id`).
    
    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    b4746aa View commit details
    Browse the repository at this point in the history
  6. refactor: Make further use of new deriving helper

    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    03c4de7 View commit details
    Browse the repository at this point in the history
  7. refactor: Applying actions takes selection

    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    9037f7e View commit details
    Browse the repository at this point in the history
  8. feat: Add canonical names to prim type def parameters

    This will make it easier to output typedefs in the API, due to increased uniformity with AST typedefs.
    
    Note that these names aren't even currently used anywhere since we don't actually have any higher-kinded primitives, only ints and chars. These would be used if we added, for example, `IO` or `Array` primitives, in which case the names would be likely useful at least for _displaying_ primitive typedefs, even though they don't actually scope over anything like they do for ASTs.
    
    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    b7e1e02 View commit details
    Browse the repository at this point in the history
  9. feat!: Output typedefs in API modules

    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    5d2efc6 View commit details
    Browse the repository at this point in the history
  10. feat: Expose available actions for typedefs

    Note that no new unit tests are added. This is because the underlying `ProgAction`s are already well-tested, e.g. in `unit_RenameType`. In due course, the property test `tasty_available_actions_accepted` will be generalised to cover typedef actions, which will therefore check that all of these new actions can be applied without error whenever they are available.
    
    We don't yet expose actions for constructor fields (i.e. `Available.forTypeDefConsFieldNode` always returns `[]`), since making this work will, unlike the other positions, require changes to the core of the library.
    
    We _could_ actually make all the `for*`s part of one definition, now that `Selection` is in `App.Base`. But we do actually use the individual functions in some tests, and with them separate, we have slightly more control, in that we don't need to provide as much context.
    
    Note that most of the changes in this commit are actually knock-on effects of generalising `Selection` to cover type defs.
    
    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    93e86d5 View commit details
    Browse the repository at this point in the history
  11. fix: Always omit nothing fields in JSON output

    This was motivated by a surprising deep equality failure on selections in a TypeScript frontend, due to a null field only present in one of the compared values.
    
    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    c1096a3 View commit details
    Browse the repository at this point in the history
  12. feat: Set better selections after performing typedef actions

    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    49fc7e5 View commit details
    Browse the repository at this point in the history
  13. feat: Add actions for modifying constructor field types

    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 30, 2023
    Configuration menu
    Copy the full SHA
    0cbc3c4 View commit details
    Browse the repository at this point in the history

Commits on May 31, 2023

  1. refactor: Remove SetConFieldType action

    It is of little use now that we have the more general `ConFieldAction`.
    
    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 31, 2023
    Configuration menu
    Copy the full SHA
    dc1bcd2 View commit details
    Browse the repository at this point in the history
  2. refactor: Remove findAndAdjustA and adjustAtA'

    We can define these in terms of their un-primed equivalents, by choosing the correct applicative, so we effectively do so and then inline.
    
    Signed-off-by: George Thomas <[email protected]>
    georgefst committed May 31, 2023
    Configuration menu
    Copy the full SHA
    2956661 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c42e031 View commit details
    Browse the repository at this point in the history