Skip to content

Restricting extra keys causes memory leak in compojure-api #433

Open

Description

@frenchy64

The fix #415 reportedly causes a memory leak in compojure-api, which assumes keys of a map schema never change their equality: metosin/compojure-api#454

Activity

  1. frenchy64 commented on Dec 1, 2021

    @frenchy64
    ContributorAuthor

    @gfredericks is there another solution to this? Could we move this code to the generators lib instead?

  2. gfredericks commented on Dec 4, 2021

    @gfredericks
    Contributor

    It does seem like moving it to generators would be better.

    Looking back at it it seems like this is where you'd want to do the filtering, but at this point in the code we only have the spec, not the schema: https://github.com/plumatic/schema-generators/blob/b0ecf2c8659ca985144c74e4be2a5a7c9e55596f/src/schema_generators/generators.cljc#L78

    Line 211 presumably could add some information to the spec (as metadata?); I'm not 100% sure that it's safe to just check if the schema is a map and look for keys that aren't a special type, but if so then seems like it would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions