Skip to content

Commit

Permalink
generate unit structs for empty objects
Browse files Browse the repository at this point in the history
  • Loading branch information
jDomantas committed May 22, 2024
1 parent cb2191c commit 489b5b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dap-types/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ pub enum InitializeRequestArgumentsPathFormat {

/// Arguments for `configurationDone` request.
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ConfigurationDoneArguments {}
pub struct ConfigurationDoneArguments;

/// Arguments for `disconnect` request.
#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down Expand Up @@ -1143,7 +1143,7 @@ pub struct ModulesResponse {

/// Arguments for `loadedSources` request.
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct LoadedSourcesArguments {}
pub struct LoadedSourcesArguments;

/// Response to `loadedSources` request.
#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down
10 changes: 4 additions & 6 deletions generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,9 @@ fn write_types(types: &[ProtocolType]) -> String {
let mut writer = Writer::default();
writer.line("use serde::{Deserialize, Serialize};");
writer.finished_object();
'outer: for ty in types {
for suffix in ["Request"] {
if ty.name.ends_with(suffix) {
continue 'outer;
}
for ty in types {
if ty.name.ends_with("Request") {
continue;
}
println!("writing type {}", ty.name);
if ty.name.ends_with("Response") {
Expand Down Expand Up @@ -586,7 +584,7 @@ impl Object {
dst.line("#[derive(Debug, Clone, Deserialize, Serialize)]");
let mut pending = Vec::new();
if self.fields.len() == 0 {
dst.line(format!("pub struct {} {{}}", name));
dst.line(format!("pub struct {};", name));
} else {
dst.line(format!("pub struct {} {{", name));
for field in &self.fields {
Expand Down

0 comments on commit 489b5b9

Please sign in to comment.