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

Order and group FTL schema output in a nicer way #1089

Closed
alecthomas opened this issue Mar 14, 2024 · 4 comments · Fixed by #1133
Closed

Order and group FTL schema output in a nicer way #1089

alecthomas opened this issue Mar 14, 2024 · 4 comments · Fixed by #1133
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@alecthomas
Copy link
Collaborator

Currently I think it's just alphabetical by (type, name):

module foo {
  config bar String

  config waz String

  data Data {}

  data Other {}

  database foo

  database waz

  secret secret String
  
  secret zap String

  verb myVerb(Data) Data
}

I think it would be nice if it was something more like:

module foo {
  config bar String
  config waz String
  secret secret String
  secret zap String

  database foo
  database waz

  data Data {}

  data Other {}

  verb myVerb(Data) Data
}
@alecthomas alecthomas added enhancement New feature or request good first issue Good for newcomers labels Mar 14, 2024
@github-actions github-actions bot added the triage Issue needs triaging label Mar 14, 2024
@worstell
Copy link
Contributor

i like this! another thought- it might be nice to add an optional flag to ftl schema get for specifying modules, so you can scope your command in the case where you have a large schema and want to inspect specific module(s)

@alecthomas
Copy link
Collaborator Author

That would be super handy, I've wanted something like that many many times.

@alecthomas
Copy link
Collaborator Author

Create another issue for it?

@worstell
Copy link
Contributor

Create another issue for it?

added #1090

@matt2e matt2e linked a pull request Mar 25, 2024 that will close this issue
@matt2e matt2e self-assigned this Mar 25, 2024
@github-actions github-actions bot removed the triage Issue needs triaging label Mar 25, 2024
matt2e added a commit that referenced this issue Mar 27, 2024
#1089

Ordering and spacing is the following (example has 2 of each declaration
type)
```
{
   config
   config
   secret
   secret

   database
   database

   enum

   enum

   data

   data

   verb

   verb
}
```

Full example:
```
module echo {
  config default String
  config default2 String
  secret default3 String
  secret default3 String

  // An echo request.
  data EchoRequest {
    name String? +alias json "name"
    inner echo.EchoRequest2 +alias json "inner"
  }

  data EchoRequest2 {
    name String? +alias json "name"
  }

  data EchoResponse {
    message String +alias json "message"
    inner echo.EchoResponse2 +alias json "inner"
  }

  data EchoResponse2 {
    message String +alias json "message"
  }

  // Echo returns a greeting with the current time.
  verb echo(echo.EchoRequest) echo.EchoResponse  
      +calls time.time

  verb echo2(echo.EchoRequest) echo.EchoResponse  
      +calls time.time
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants