Skip to content

Commit

Permalink
Change compiler/runner version (commands) in API to conform with spec. (
Browse files Browse the repository at this point in the history
#2094)

* Change compiler/runner version (commands) in API to conform with spec.

See
https://ccs-specs.icpc.io/draft/contest_api?highlight=languages#examples-5

* Fix null check
  • Loading branch information
meisterT authored Jul 22, 2023
1 parent a366fe6 commit 1a0b40e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions webapp/src/Entity/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,19 @@ class Language extends BaseApiEntity
private Collection $versions;

#[ORM\Column(type: 'blobtext', nullable: true, options: ['comment' => 'Compiler version'])]
#[Serializer\Exclude]
private ?string $compilerVersion = null;

#[ORM\Column(type: 'blobtext', nullable: true, options: ['comment' => 'Runner version'])]
#[Serializer\Exclude]
private ?string $runnerVersion = null;

#[ORM\Column(type: 'string', length: 255, nullable: true, options: ['comment' => 'Runner version command'])]
#[Serializer\Exclude]
private ?string $runnerVersionCommand = null;

#[ORM\Column(type: 'string', length: 255, nullable: true, options: ['comment' => 'Compiler version command'])]
#[Serializer\Exclude]
private ?string $compilerVersionCommand = null;

/**
Expand Down Expand Up @@ -207,6 +211,36 @@ public function getCompileExecutableHash(): ?string
return $this->compile_executable?->getImmutableExecutable()->getHash();
}

#[Serializer\VirtualProperty]

Check failure on line 214 in webapp/src/Entity/Language.php

View workflow job for this annotation

GitHub Actions / phpstan

Method App\Entity\Language::getCompilerData() return type has no value type specified in iterable type array.
#[Serializer\SerializedName('compiler')]
#[Serializer\Exclude(if:'object.getCompilerVersionCommand() == ""')]
public function getCompilerData(): ?array
{
$ret = [];
if (!empty($this->getCompilerVersionCommand())) {
$ret['version_command'] = $this->getCompilerVersionCommand();
if (!empty($this->getCompilerVersion())) {
$ret['version'] = $this->getCompilerVersion();
}
}
return $ret;
}

#[Serializer\VirtualProperty]

Check failure on line 229 in webapp/src/Entity/Language.php

View workflow job for this annotation

GitHub Actions / phpstan

Method App\Entity\Language::getRunnerData() return type has no value type specified in iterable type array.
#[Serializer\SerializedName('runner')]
#[Serializer\Exclude(if:'object.getRunnerVersionCommand() == ""')]
public function getRunnerData(): ?array
{
$ret = [];
if (!empty($this->getRunnerVersionCommand())) {
$ret['version_command'] = $this->getRunnerVersionCommand();
if (!empty($this->getRunnerVersion())) {
$ret['version'] = $this->getRunnerVersion();
}
}
return $ret;
}

public function setLangid(string $langid): Language
{
$this->langid = $langid;
Expand Down

0 comments on commit 1a0b40e

Please sign in to comment.